diff --git a/src/lib/views/TranscriptNotes.svelte b/src/lib/views/TranscriptNotes.svelte index d6b0255..7e33d31 100644 --- a/src/lib/views/TranscriptNotes.svelte +++ b/src/lib/views/TranscriptNotes.svelte @@ -74,6 +74,10 @@ let editorEl: HTMLTextAreaElement | undefined = $state(); let saveTimer: ReturnType | undefined; let loadedForId: string | null = null; + // The server copy the buffer was last synced against — lets the effect below + // tell a server-side notes change (speaker rename, reprocess) apart from the + // user's own unsaved edits. + let lastServerNotes: string | null = null; // Transcript/notes split (FR-UX-1): resizable (drag the Splitter) and // each side independently hideable, shared across the finalized-meeting @@ -111,14 +115,23 @@ selectedSegmentMs = null; }); - // Sync the editor buffer whenever a different meeting is selected. + // Sync the editor buffer whenever a different meeting is selected — and when + // the *server* copy of the same meeting's notes changes underneath us (a + // speaker rename rewrites notes.md's dialogue tags, reprocess regenerates it). + // A buffer with unsaved local edits is never clobbered: it only adopts the + // server copy when it still equals the last-synced one. $effect(() => { const m = meetings.selected; if (m && m.id !== loadedForId) { notesText = m.notes_markdown; + lastServerNotes = m.notes_markdown; loadedForId = m.id; + } else if (m && m.id === loadedForId && m.notes_markdown !== lastServerNotes) { + if (notesText === lastServerNotes) notesText = m.notes_markdown; + lastServerNotes = m.notes_markdown; } else if (!m) { loadedForId = null; + lastServerNotes = null; } }); @@ -357,9 +370,9 @@ style="grid-template-columns: {splitColumns()};" bind:clientWidth={splitWidth} > - + +