diff --git a/src/apps/notes/Draft.tsx b/src/apps/notes/Draft.tsx index 4db0494..6481eb7 100644 --- a/src/apps/notes/Draft.tsx +++ b/src/apps/notes/Draft.tsx @@ -27,7 +27,10 @@ export function DraftNote({ onPublished }: { onPublished: (id: string) => void } const trimmed = draft.trim(); const handlePublish = async () => { - if (!trimmed) return; + // Guarded here too, not just via the button's `disabled` — React hasn't + // necessarily re-rendered with publish.isPending yet when a second click + // lands in the same tick, and mutateAsync itself doesn't dedupe calls. + if (!trimmed || publish.isPending) return; try { const event = await publish.mutateAsync({ kind: 1, content: trimmed, tags: [] }); setDraft(''); diff --git a/src/apps/notes/index.tsx b/src/apps/notes/index.tsx index 50457e2..a7f2155 100644 --- a/src/apps/notes/index.tsx +++ b/src/apps/notes/index.tsx @@ -67,7 +67,7 @@ export default function NotesApp({ params, setTitle, setParams }: AppProps) { }, [id, name, setTitle]); if (!id) { - return setParams({ id: publishedId })} />; + return setParams({ ...params, id: publishedId })} />; } if (note.isLoading) {