fix: + buttons for note creation pass MouseEvent as type, causing crash

onClick={onCreateNote} passes the React MouseEvent as the first arg
to handleCreateNoteImmediate(type?), which treats it as a truthy type
string. generateUntitledName then calls .toLowerCase() on the event
object, throwing a TypeError and silently aborting note creation.

Wrap both NoteList and TabBar onClick handlers to call with no args.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-02-22 09:50:54 +01:00
parent 8c28ea1214
commit abf838640d
2 changed files with 2 additions and 2 deletions

View File

@@ -611,7 +611,7 @@ function NoteListInner({ entries, selection, selectedNote, allContent, modifiedF
</button>
<button
className="flex items-center text-muted-foreground transition-colors hover:text-foreground"
onClick={onCreateNote}
onClick={() => onCreateNote()}
title="Create new note"
>
<Plus size={16} />

View File

@@ -183,7 +183,7 @@ export const TabBar = memo(function TabBar({
>
<button
className="flex items-center justify-center border-none bg-transparent p-0 text-muted-foreground cursor-pointer hover:text-foreground transition-colors"
onClick={onCreateNote}
onClick={() => onCreateNote?.()}
title="New note"
>
<Plus size={16} />