mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 00:02:29 +00:00
Move notebook cell editor refs out of effect (#3077)
This commit is contained in:
@@ -295,6 +295,10 @@ function CodeCell({
|
||||
const editorFontZoomLevel = useAppStore((s) => s.editorFontZoomLevel)
|
||||
const onDeactivateRef = useRef(onDeactivate)
|
||||
const onSaveRequestRef = useRef(onSaveRequest)
|
||||
// Why: Monaco commands/listeners are installed once on mount and need the
|
||||
// latest callbacks without rebuilding the embedded editor.
|
||||
onDeactivateRef.current = onDeactivate
|
||||
onSaveRequestRef.current = onSaveRequest
|
||||
const fontSize = computeEditorFontSize(settings?.terminalFontSize ?? 13, editorFontZoomLevel)
|
||||
const lineCount = Math.max(3, source.split('\n').length + 1)
|
||||
const editorHeight = Math.min(520, Math.max(96, lineCount * (fontSize + 8)))
|
||||
@@ -325,11 +329,6 @@ function CodeCell({
|
||||
})
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
onDeactivateRef.current = onDeactivate
|
||||
onSaveRequestRef.current = onSaveRequest
|
||||
}, [onDeactivate, onSaveRequest])
|
||||
|
||||
useEffect(() => {
|
||||
monaco.editor.setTheme(isDark ? 'vs-dark' : 'vs')
|
||||
}, [isDark])
|
||||
|
||||
Reference in New Issue
Block a user