Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: crash on adding topics

thecodrr7fb3355f7ef9
diff --git a/apps/web/src/components/dialogs/add-notebook-dialog.js b/apps/web/src/components/dialogs/add-notebook-dialog.js
index a71ce4a56..4e8d9e350 100644
--- a/apps/web/src/components/dialogs/add-notebook-dialog.js
+++ b/apps/web/src/components/dialogs/add-notebook-dialog.js
@@ -11,12 +11,14 @@ export default class AddNotebookDialog extends React.Component {
_inputRefs = [];
lastLength = 0;
state = {
- topics: [],
+ topics: [""],
open: false
};
addTopic(index) {
- this.setState({ topics: this.state.topics.splice(index + 1, 0, "") }, () =>
+ const topics = this.state.topics.slice();
+ topics.splice(index + 1, 0, "");
+ this.setState({ topics }, () =>
setTimeout(() => {
this._inputRefs[index + 1].focus();
}, 0)