diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx index 4e14952268b..2f5b532fb11 100644 --- a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx +++ b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx @@ -267,7 +267,7 @@ export const SQLEditor = () => { const selection = editor.getSelection() const selectedValue = selection ? editor.getModel()?.getValueInRange(selection) : undefined - const sql = snippet + let sql = snippet ? (selectedValue || editorRef.current?.getValue()) ?? snippet.snippet.content?.sql : selectedValue || editorRef.current?.getValue()