From 1e754aea31e90dbf0bf26f7f12187dc5678442b8 Mon Sep 17 00:00:00 2001 From: Spencer Torres Date: Mon, 20 Nov 2023 17:52:11 -0500 Subject: [PATCH] prevent overwriting state for raw sql editor --- src/views/CHQueryEditor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/CHQueryEditor.tsx b/src/views/CHQueryEditor.tsx index 3daf6ac9..60ca3b47 100644 --- a/src/views/CHQueryEditor.tsx +++ b/src/views/CHQueryEditor.tsx @@ -42,7 +42,7 @@ const CHEditorByType = (props: CHQueryEditorProps) => { */ const queryKey = query.key || '' const lastKey = useRef(queryKey); - if (queryKey !== lastKey.current) { + if (queryKey !== lastKey.current && query.editorType === EditorType.Builder) { builderOptionsDispatch(setAllOptions((query as CHBuilderQuery).builderOptions || {})); lastKey.current = queryKey; } @@ -54,7 +54,7 @@ const CHEditorByType = (props: CHQueryEditorProps) => { } useEffect(() => { - if (shouldSkipChanges.current) { + if (shouldSkipChanges.current || query.editorType !== EditorType.Builder) { return; }