From b2feed0e924c36d4d1610df6c47ab50c29b60cec Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Wed, 28 Oct 2026 17:26:47 -0700 Subject: [PATCH] fix(editor): scope Mermaid diagram scroll position per pane (#34983) Key MermaidViewer's scroll cache with the pane-scoped editorViewStateKey, matching IpynbViewer, so split panes showing the same .mmd file no longer overwrite each other's saved diagram position. Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- .../src/components/editor/EditorEditFileSurface.tsx | 6 +++++- src/renderer/src/components/editor/MermaidViewer.tsx | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/components/editor/EditorEditFileSurface.tsx b/src/renderer/src/components/editor/EditorEditFileSurface.tsx index 7363a4ea687..8fa136494d1 100644 --- a/src/renderer/src/components/editor/EditorEditFileSurface.tsx +++ b/src/renderer/src/components/editor/EditorEditFileSurface.tsx @@ -274,7 +274,11 @@ export function EditorEditFileSurface({ monacoEditor={monacoEditor} /> ) : isMermaid && mdViewMode === 'rich' ? ( - + ) : isCsv && mdViewMode === 'rich' ? ( (null) const isDark = useDocumentDarkTheme() - // Source and diagram heights differ; keep their scroll positions separate. - const scrollCacheKey = `${filePath}:mermaid-diagram` - useLayoutEffect(() => { const container = rootRef.current if (!container) {