From f786f30d3a7cba096e8ff366e03b3eb64008290c Mon Sep 17 00:00:00 2001 From: Florent Date: Wed, 10 Jul 2024 14:11:43 +0200 Subject: [PATCH] Fix JS error on document access denied page --- dockerfiles/grist/ressources/dinum-custom.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dockerfiles/grist/ressources/dinum-custom.js b/dockerfiles/grist/ressources/dinum-custom.js index 77fc16f..2286e77 100644 --- a/dockerfiles/grist/ressources/dinum-custom.js +++ b/dockerfiles/grist/ressources/dinum-custom.js @@ -133,10 +133,13 @@ window.addEventListener('load', async (event) => { await waitForElm('body.interface-full'); - // gristApp.topAppModel.appObs is not populated at that point, listen for the observer to their first change - + const appObs = gristApp.topAppModel && gristApp.topAppModel.appObs; + if (!appObs) { + return; + } + // appObs is not populated at that point, listen for the observer to their first change let listener; - listener = gristApp.topAppModel.appObs.addListener( async (appObs) => { + listener = appObs.addListener( async (appObs) => { // Gauffre must be displayed only in home pages if (appObs.pageType.get() !== "home"){ return 1;