mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-29 00:20:04 +01:00
web: fix crash on opening notebook context menu
This commit is contained in:
@@ -135,16 +135,14 @@ const menuItems = [
|
||||
title: "Set as default",
|
||||
checked: ({ notebook }) => {
|
||||
const defaultNotebook = db.settings.getDefaultNotebook();
|
||||
return defaultNotebook.id === notebook.id && !defaultNotebook.topic;
|
||||
return defaultNotebook?.id === notebook.id && !defaultNotebook?.topic;
|
||||
},
|
||||
|
||||
icon: Icon.Notebook,
|
||||
onClick: async ({ notebook }) => {
|
||||
const defaultNotebook = db.settings.getDefaultNotebook();
|
||||
const isDefault =
|
||||
defaultNotebook &&
|
||||
defaultNotebook.id === notebook.id &&
|
||||
!defaultNotebook.topic;
|
||||
defaultNotebook?.id === notebook.id && !defaultNotebook?.topic;
|
||||
|
||||
await db.settings.setDefaultNotebook(
|
||||
isDefault ? undefined : { id: notebook.id }
|
||||
|
||||
@@ -94,9 +94,8 @@ const menuItems = [
|
||||
onClick: async ({ topic }) => {
|
||||
const defaultNotebook = db.settings.getDefaultNotebook();
|
||||
const isDefault =
|
||||
defaultNotebook &&
|
||||
defaultNotebook.id === topic.notebookId &&
|
||||
defaultNotebook.topic === topic.id;
|
||||
defaultNotebook?.id === topic.notebookId &&
|
||||
defaultNotebook?.topic === topic.id;
|
||||
|
||||
await db.settings.setDefaultNotebook(
|
||||
isDefault ? undefined : { id: topic.notebookId, topic: topic.id }
|
||||
|
||||
Reference in New Issue
Block a user