diff --git a/src/services/notes.js b/src/services/notes.js index e5634df..653af57 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -36,7 +36,7 @@ export function updateNote(ownerId, id, input) { const patch = {}; if (input.title !== undefined) patch.title = requireString(input, 'title', { max: 120 }); if (input.body !== undefined) patch.body = requireString(input, 'body', { max: 10000 }); - if (input.tags !== undefined) patch.tags = input.tags && optionalTags(input); + if (input.tags !== undefined) patch.tags = optionalTags(input); invalidate(`notes:${ownerId}`); record(ownerId, 'note.update', id); return update('notes', id, patch); diff --git a/src/utils/format.js b/src/utils/format.js index 24a3a09..230cc5d 100644 --- a/src/utils/format.js +++ b/src/utils/format.js @@ -19,7 +19,7 @@ export function noteSummary(note) { title: note.title, preview: truncate(note.body, 40), created: formatDate(note.createdAt), - tags: [...note.tags].sort(), + tags: [...(note.tags ?? [])].sort(), }; }