Skip to content

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

fix: notebook dialog should reset on close

thecodrr7416805a3b3e
diff --git a/apps/web/src/components/dialogs/add-notebook-dialog.js b/apps/web/src/components/dialogs/add-notebook-dialog.js
index e042ad57b..829e39731 100644
--- a/apps/web/src/components/dialogs/add-notebook-dialog.js
+++ b/apps/web/src/components/dialogs/add-notebook-dialog.js
@@ -7,13 +7,12 @@ import { showSnack } from "../snackbar";
export default class AddNotebookDialog extends React.Component {
MAX_AVAILABLE_HEIGHT = window.innerHeight * 0.3;
- title = [];
- description = [];
+ title = "";
+ description = "";
_inputRefs = [];
lastLength = 0;
state = {
topics: [""],
- open: false,
focusedInputIndex: -1
};
@@ -46,6 +45,23 @@ export default class AddNotebookDialog extends React.Component {
);
}
+ UNSAFE_componentWillReceiveProps(nextProps) {
+ if (nextProps.isOpen === false) {
+ this._reset();
+ }
+ }
+
+ _reset() {
+ this.title = "";
+ this.description = "";
+ this._inputRefs = [];
+ this.lastLength = 0;
+ this.setState({
+ topics: [""],
+ focusedInputIndex: -1
+ });
+ }
+
render() {
const props = this.props;
return (