From 5e458db6ee603bcb71451eb6c15abcf2f6769d57 Mon Sep 17 00:00:00 2001 From: bnz183 Date: Tue, 16 Jun 2026 21:02:42 +0200 Subject: [PATCH] fix: clear pre-existing Studio editor lint errors Drop unused initializers in insertFileLink and scope an eslint-disable around the intentional latest-ref slash-extension pattern. No behavior change; build, unit tests, and e2e all pass. Co-Authored-By: Claude Opus 4.8 --- apps/studio/src/editor/EditorToolbar.tsx | 4 ++-- apps/studio/src/editor/SourceDraftEditor.tsx | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/studio/src/editor/EditorToolbar.tsx b/apps/studio/src/editor/EditorToolbar.tsx index 32def97..a51ca99 100644 --- a/apps/studio/src/editor/EditorToolbar.tsx +++ b/apps/studio/src/editor/EditorToolbar.tsx @@ -168,8 +168,8 @@ export function EditorToolbar({ } function insertFileLink(currentEditor: Editor) { - let path = ""; - let filename = "Document"; + let path: string; + let filename: string; if (latestUpload?.kind === "pdf") { path = latestUpload.publicPath; diff --git a/apps/studio/src/editor/SourceDraftEditor.tsx b/apps/studio/src/editor/SourceDraftEditor.tsx index f3e2e00..6c703d6 100644 --- a/apps/studio/src/editor/SourceDraftEditor.tsx +++ b/apps/studio/src/editor/SourceDraftEditor.tsx @@ -72,6 +72,10 @@ export function SourceDraftEditor({ const bodyVersion = useRef(body); const slashHandlerRef = useRef<(command: SlashCommandId) => void>(() => {}); + // Build the slash extension once and dispatch to the latest handler through + // slashHandlerRef, so the Tiptap extension is not rebuilt on every render. + // The React Compiler flags this intentional latest-ref pattern. + /* eslint-disable react-hooks/preserve-manual-memoization, react-hooks/refs */ const slashExtension = useMemo( () => createSlashCommandsExtension( @@ -109,6 +113,7 @@ export function SourceDraftEditor({ ), [], ); + /* eslint-enable react-hooks/preserve-manual-memoization, react-hooks/refs */ const editor = useEditor({ extensions: [