Skip to content

Commit c777122

Browse files
refactor(web): pass a stable editor-change callback to the file editor
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 777268d commit c777122

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎apps/web/src/components/files/FilePreviewPanel.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import { MediaActions, type MediaActionSource } from "~/components/media/MediaAc
5757
import { useRemoteOpenState } from "~/remoteOpen";
5858
import { useClientSettings } from "~/hooks/useSettings";
5959
import { useTheme } from "~/hooks/useTheme";
60+
import { useStableCallback } from "~/hooks/useStableCallback";
6061
import { getLocalStorageItem, setLocalStorageItem, useLocalStorage } from "~/hooks/useLocalStorage";
6162
import { resolveDiffThemeName } from "~/lib/diffRendering";
6263
import { PREFERRED_HIGHLIGHTER } from "~/lib/syntaxHighlighting";
@@ -1174,6 +1175,7 @@ export default function FilePreviewPanel({
11741175
fileEditorRef.current = editor;
11751176
focusEditorFromContent();
11761177
};
1178+
const handleEditorChangeStable = useStableCallback(handleEditorChange);
11771179
const rendered = isMermaid
11781180
? renderMermaid
11791181
: isMarkdown
@@ -1584,7 +1586,7 @@ export default function FilePreviewPanel({
15841586
wordWrap={wordWrap}
15851587
onPostRender={onFilePostRender}
15861588
onPendingChange={onPendingChange}
1587-
onEditorChange={handleEditorChange}
1589+
onEditorChange={handleEditorChangeStable}
15881590
/>
15891591
</DiffWorkerPoolProvider>
15901592
)

0 commit comments

Comments
 (0)