diff --git a/src/frontend/src/components/editors/NotesEditor.tsx b/src/frontend/src/components/editors/NotesEditor.tsx index c849311f99..2d04ca75a6 100644 --- a/src/frontend/src/components/editors/NotesEditor.tsx +++ b/src/frontend/src/components/editors/NotesEditor.tsx @@ -142,7 +142,12 @@ export default function NotesEditor({ // Callback to save notes to the server const saveNotes = useCallback(() => { - const markdown = ref.current?.getMarkdown() ?? ''; + const markdown = ref.current?.getMarkdown(); + + if (!noteUrl || markdown === undefined) { + return; + } + api .patch(noteUrl, { notes: markdown }) .then(() => { diff --git a/src/frontend/tests/pages/pui_part.spec.ts b/src/frontend/tests/pages/pui_part.spec.ts index bcf8d86ff1..92df792a54 100644 --- a/src/frontend/tests/pages/pui_part.spec.ts +++ b/src/frontend/tests/pages/pui_part.spec.ts @@ -212,6 +212,7 @@ test('PUI - Pages - Part - Notes', async ({ page }) => { .fill('This is some data\n'); // Save + await page.waitForTimeout(1000); await page.getByLabel('save-notes').click(); await page.getByText('Notes saved successfully').waitFor();