From: Daniel Karbach Date: Mon, 17 Jul 2023 12:55:44 +0000 (+0200) Subject: work around removeOverlay error X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=52dbc97730d1884d3c452fea52be5f5f0e6659e4;p=alttp.git work around removeOverlay error --- diff --git a/resources/js/components/map/Overlay.js b/resources/js/components/map/Overlay.js index 4ec503a..747d0e4 100644 --- a/resources/js/components/map/Overlay.js +++ b/resources/js/components/map/Overlay.js @@ -40,7 +40,12 @@ const Overlay = ({ children, height, onClick, page, width, x, y }) => { viewer.addHandler('page', addPage); return () => { viewer.removeHandler('page', addPage); - viewer.removeOverlay(element); + try { + viewer.removeOverlay(element); + } catch (e) { + // bug in OSD? + console.error(e); + } }; } if (viewer.isOpen()) { @@ -49,7 +54,12 @@ const Overlay = ({ children, height, onClick, page, width, x, y }) => { viewer.addHandler('open', add); return () => { viewer.removeHandler('open', add); - viewer.removeOverlay(element); + try { + viewer.removeOverlay(element); + } catch (e) { + // bug in OSD? + console.error(e); + } }; } }, [onClick, height, page, viewer, width, x, y]);