From 3188385e751b54adf5cc7f231528edf61d40044f Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Thu, 7 Apr 2022 21:57:45 -0700 Subject: [PATCH] catch and dismiss errors syncing --- net/web/src/AppContext/useAppContext.hook.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/net/web/src/AppContext/useAppContext.hook.js b/net/web/src/AppContext/useAppContext.hook.js index dc6c60d1..766f260f 100644 --- a/net/web/src/AppContext/useAppContext.hook.js +++ b/net/web/src/AppContext/useAppContext.hook.js @@ -187,7 +187,7 @@ export function useAppContext() { cards.current.forEach((value, key, map) => { if (value?.data?.cardDetail?.status === 'connected') { value.channels.forEach((slot, key, map) => { - merged.push({ contact: value?.data?.cardProfile?.guid, channel: slot }); + merged.push({ guid: value?.data?.cardProfile?.guid, cardId: value?.id, channel: slot }); }); } }); @@ -312,12 +312,17 @@ export function useAppContext() { const setWebsocket = (token) => { ws.current = new WebSocket("wss://" + window.location.host + "/status"); ws.current.onmessage = (ev) => { - if (revision.current != null) { - revision.current = JSON.parse(ev.data); + try { + if (revision.current != null) { + revision.current = JSON.parse(ev.data); + } + else { + revision.current = JSON.parse(ev.data); + processRevision(token) + } } - else { - revision.current = JSON.parse(ev.data); - processRevision(token) + catch (err) { + console.log(err); } } ws.current.onclose = (e) => {