From b716a57e3110b1d609da43f982327fbcc6ee334d Mon Sep 17 00:00:00 2001 From: Dmitry S Date: Sat, 4 Sep 2021 03:04:52 -0400 Subject: [PATCH] (core) Avoid loading the Grist frontend app more than once. Summary: This can happen thanks to some badly-behaved extensions (e.g. lingvanex), and results in errors such as "Cannot redefine property: isInput". Test Plan: Tested manually that Grist fails to load in Chrome with Lingvanex extension, and loads successfully with this change. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3013 --- app/client/app.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/client/app.js b/app/client/app.js index e9a03509..6649fa9a 100644 --- a/app/client/app.js +++ b/app/client/app.js @@ -1,5 +1,13 @@ /* global $, window */ +// This is the entry point into loading the whole of Grist frontend application. Some extensions +// attempt to load it more than once (e.g. "Lingvanex"). This leads to duplicated work and errors. +// At least some of such interference can be neutralized by simply ignoring repeated loads. +if (window._gristAppLoaded) { + return; +} +window._gristAppLoaded = true; + const {App} = require('./ui/App'); // Disable longStackTraces, which seem to be enabled in the browser by default.