fix creating new notebook

This commit is contained in:
ammarahm-ed
2022-01-08 09:37:58 +05:00
parent 0db453d8ed
commit 4e6320b3fe

View File

@@ -158,7 +158,8 @@ export class AddNotebookDialog extends React.Component {
}); });
return; return;
} }
if (notesnook) { let toEdit = null;
if (notebook) {
toEdit = db.notebooks.notebook(notebook.id).data; toEdit = db.notebooks.notebook(notebook.id).data;
} }
@@ -172,7 +173,8 @@ export class AddNotebookDialog extends React.Component {
this.currentInputValue = null; this.currentInputValue = null;
} }
} }
if (notesnook) {
if (notebook) {
if (this.topicsToDelete?.length > 0) { if (this.topicsToDelete?.length > 0) {
await db.notebooks await db.notebooks
.notebook(toEdit.id) .notebook(toEdit.id)
@@ -203,7 +205,8 @@ export class AddNotebookDialog extends React.Component {
await db.notebooks.add({ await db.notebooks.add({
title: this.title, title: this.title,
description: this.description, description: this.description,
topics: prevTopics topics: prevTopics,
id:null
}); });
} }
useMenuStore.getState().setMenuPins(); useMenuStore.getState().setMenuPins();
@@ -286,7 +289,7 @@ export class AddNotebookDialog extends React.Component {
descFocused: false, descFocused: false,
titleFocused: false, titleFocused: false,
editTopic: false, editTopic: false,
notesnook: null notebook: null
}); });
}} }}
statusBarTranslucent={false} statusBarTranslucent={false}