Mute annoying error that occurs when ME_QUERY is not yet in cache

This commit is contained in:
Ramon Wenger 2023-12-21 17:38:07 +01:00
parent fdbdcb366e
commit d0de5de269
1 changed files with 16 additions and 9 deletions

View File

@ -138,6 +138,7 @@ export default {
) {
if (topic) {
const query = ME_QUERY;
try {
const { me } = store.readQuery({ query });
if (me) {
const data = {
@ -148,6 +149,12 @@ export default {
};
store.writeQuery({ query, data });
}
} catch (error: unknown) {
if (!(error instanceof TypeError)) {
throw error;
}
// otherwise, the store didn't contain the data, this is fine, we ignore it
}
}
},
});