From b77aba016771cad6a64e731e07ed9babdecefdf6 Mon Sep 17 00:00:00 2001 From: nmemmert Date: Thu, 18 Jun 2026 13:46:41 -0400 Subject: [PATCH] build notes fix --- src/colossiansStudy.tsx | 20 -------------------- src/components/NoteCard.tsx | 2 +- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/colossiansStudy.tsx b/src/colossiansStudy.tsx index 2a7b895..f395988 100644 --- a/src/colossiansStudy.tsx +++ b/src/colossiansStudy.tsx @@ -1491,7 +1491,6 @@ export function ColossiansStudySectionPage({ content }: Props) { const [noteMap, setNoteMap] = useState>({}) const [openAnchor, setOpenAnchor] = useState(null) const [noteLoading, setNoteLoading] = useState(false) - const [noteSaving, setNoteSaving] = useState(false) const [noteMessage, setNoteMessage] = useState('') const noteMapDirtyRef = useRef(false) const [contextNoteMenu, setContextNoteMenu] = useState<{ x: number; y: number; text: string; anchor: NoteAnchorId } | null>(null) @@ -1504,7 +1503,6 @@ export function ColossiansStudySectionPage({ content }: Props) { const [autoSaveMsg, setAutoSaveMsg] = useState('') const [_checkpointReflection, _setCheckpointReflection] = useState('') - const canSaveNote = auth.authenticated && !noteSaving && !noteLoading const savedNoteCount = Object.values(noteMap).filter(v => v?.trim()).length const lessonAudioEmbedUrl = useMemo(() => { const trimmed = section?.audioEmbedUrl?.trim() ?? '' @@ -1634,24 +1632,6 @@ export function ColossiansStudySectionPage({ content }: Props) { setNoteMap(prev => ({ ...prev, [anchor]: html })) } - async function saveNote() { - if (!noteId || !canSaveNote) return - setNoteSaving(true) - setNoteMessage('') - try { - await readJson<{ ok: boolean; note: string }>(`/api/study-notes/${encodeURIComponent(noteId)}`, { - method: 'PUT', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ note: JSON.stringify(noteMap) }), - }) - noteMapDirtyRef.current = false - setNoteMessage('Notes saved.') - } catch (err) { - setNoteMessage(err instanceof Error ? err.message : 'Unable to save note.') - } finally { - setNoteSaving(false) - } - } useEffect(() => { if (!openAnchor) return diff --git a/src/components/NoteCard.tsx b/src/components/NoteCard.tsx index 27bcc9b..9599492 100644 --- a/src/components/NoteCard.tsx +++ b/src/components/NoteCard.tsx @@ -23,7 +23,7 @@ export function NoteCard({ anchorLabel, html, autoSaveMsg, onChange, onClose }: useEffect(() => { if (!editor || editor.isDestroyed) return if (editor.getHTML() !== html) { - editor.commands.setContent(html || '

', false) + editor.commands.setContent(html || '

', { emitUpdate: false }) } // eslint-disable-next-line react-hooks/exhaustive-deps }, [html])