From 6cf47fc98afd7c59218421d4b12e29a4e816dea8 Mon Sep 17 00:00:00 2001 From: PxPerfectMike Date: Mon, 23 Feb 2026 04:38:38 -0800 Subject: [PATCH] fix: prevent cursor jumping to end when editing blog content Remove `content` from useEffect dependency array to break the feedback loop where every keystroke would trigger setContent(), resetting the cursor position to the end. The editor's internal state is managed by Tiptap via onUpdate. The useEffect only needs to run once when the editor initializes to set the initial content. Fixes #31 --- app/components/editor/Tiptap.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/components/editor/Tiptap.tsx b/app/components/editor/Tiptap.tsx index a687746..8f39797 100644 --- a/app/components/editor/Tiptap.tsx +++ b/app/components/editor/Tiptap.tsx @@ -26,11 +26,13 @@ const Tiptap: React.FC<{ }); useEffect(() => { if (!editor) return; - const value = content; - if (value) { - editor.commands.setContent(value); + if (content) { + editor.commands.setContent(content); } - }, [editor, content]); + // Only set content when editor initializes, not on every content change. + // Content updates from user input are handled by onUpdate callback. + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [editor]); return (