From 5e480b155f695e5554f4c73d7fc51f70974d951a Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Thu, 22 Aug 2024 09:08:31 +0200 Subject: [PATCH] Fix code preservation of preferences change --- client/src/App.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index bc028b3b..9bb09b24 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -302,7 +302,12 @@ function App() { // Load content from source URL useEffect(() => { - if (!(editor && url)) { return } + if (!editor || !url || code || codeFromUrl) { + // Do not execute if editor is not ready, if there is no URL to parse + // or if the editor already has some code loaded + // (last point is important for when settings change) + return + } console.debug(`[Lean4web] Loading from ${url}`) let txt = "Loading…" setContent(txt)