From d0de5de269af8faaec0240c262d104010afea08c Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Thu, 21 Dec 2023 17:38:07 +0100 Subject: [PATCH] Mute annoying error that occurs when ME_QUERY is not yet in cache --- client/src/pages/topic-page.vue | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/client/src/pages/topic-page.vue b/client/src/pages/topic-page.vue index 9a21db66..27e3b81c 100644 --- a/client/src/pages/topic-page.vue +++ b/client/src/pages/topic-page.vue @@ -138,15 +138,22 @@ export default { ) { if (topic) { const query = ME_QUERY; - const { me } = store.readQuery({ query }); - if (me) { - const data = { - me: { - ...me, - lastTopic: topic, - }, - }; - store.writeQuery({ query, data }); + try { + const { me } = store.readQuery({ query }); + if (me) { + const data = { + me: { + ...me, + lastTopic: topic, + }, + }; + 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 } } },