Skip to content

Commit 0723fa7

Browse files
committed
wip
1 parent dac3106 commit 0723fa7

3 files changed

Lines changed: 357 additions & 60 deletions

File tree

apps/dashboard/src/components/BottomPanel.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ function QueryEditorPanel({ isFullscreen = false }: { isFullscreen?: boolean })
169169

170170
const [localCode, setLocalCode] = useState('');
171171
const prevQueryIdRef = useRef(selectedQueryId);
172+
const runQueryRef = useRef<() => void>(() => {});
172173

173174
// Sync local code when selection changes
174175
useEffect(() => {
@@ -199,6 +200,9 @@ function QueryEditorPanel({ isFullscreen = false }: { isFullscreen?: boolean })
199200
}
200201
}, [selectedQuery, localCode, updateQuery, setQueryRunning, setQueryResult, setQueryError]);
201202

203+
// Keep ref updated with latest runQuery
204+
runQueryRef.current = runQuery;
205+
202206
const handleEditorChange = useCallback((value: string | undefined) => {
203207
setLocalCode(value || '');
204208
}, []);
@@ -268,6 +272,20 @@ function QueryEditorPanel({ isFullscreen = false }: { isFullscreen?: boolean })
268272
rayfallRegistered = true;
269273
}
270274
}}
275+
onMount={(editor, monaco) => {
276+
// Register Ctrl+Enter to run query
277+
editor.addAction({
278+
id: 'run-query',
279+
label: 'Run Query',
280+
keybindings: [
281+
monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter,
282+
],
283+
run: () => {
284+
// Use ref to always get latest runQuery function
285+
runQueryRef.current();
286+
},
287+
});
288+
}}
271289
options={{
272290
minimap: { enabled: false },
273291
fontSize: 14,

0 commit comments

Comments
 (0)