Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/studio/src/editor/EditorToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions apps/studio/src/editor/SourceDraftEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -109,6 +113,7 @@ export function SourceDraftEditor({
),
[],
);
/* eslint-enable react-hooks/preserve-manual-memoization, react-hooks/refs */

const editor = useEditor({
extensions: [
Expand Down
Loading