Skip to content

Commit

Permalink
prevent overwriting state for raw sql editor
Browse files Browse the repository at this point in the history
  • Loading branch information
SpencerTorres committed Nov 20, 2023
1 parent 9ce2908 commit 1e754ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/views/CHQueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const CHEditorByType = (props: CHQueryEditorProps) => {
*/
const queryKey = query.key || ''
const lastKey = useRef<string>(queryKey);
if (queryKey !== lastKey.current) {
if (queryKey !== lastKey.current && query.editorType === EditorType.Builder) {
builderOptionsDispatch(setAllOptions((query as CHBuilderQuery).builderOptions || {}));
lastKey.current = queryKey;
}
Expand All @@ -54,7 +54,7 @@ const CHEditorByType = (props: CHQueryEditorProps) => {
}

useEffect(() => {
if (shouldSkipChanges.current) {
if (shouldSkipChanges.current || query.editorType !== EditorType.Builder) {
return;
}

Expand Down

0 comments on commit 1e754ae

Please sign in to comment.