mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
optimize moving note performance
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
|||||||
sendNoteEditedEvent,
|
sendNoteEditedEvent,
|
||||||
ToastEvent,
|
ToastEvent,
|
||||||
} from '../../services/EventManager';
|
} from '../../services/EventManager';
|
||||||
|
import Navigation from '../../services/Navigation';
|
||||||
import {db} from '../../utils/DB';
|
import {db} from '../../utils/DB';
|
||||||
import {
|
import {
|
||||||
eOnNewTopicAdded,
|
eOnNewTopicAdded,
|
||||||
@@ -58,11 +59,14 @@ const MoveNoteDialog = () => {
|
|||||||
newTopicTitle = null;
|
newTopicTitle = null;
|
||||||
newNotebookTitle = null;
|
newNotebookTitle = null;
|
||||||
setNote(null);
|
setNote(null);
|
||||||
eSendEvent(refreshNotesPage);
|
Navigation.setRoutesToUpdate([
|
||||||
eSendEvent(eOnNewTopicAdded);
|
Navigation.routeNames.Notes,
|
||||||
|
Navigation.routeNames.Favorites,
|
||||||
|
Navigation.routeNames.NotesPage,
|
||||||
|
Navigation.routeNames.Notebook,
|
||||||
|
Navigation.routeNames.Notebooks,
|
||||||
|
]);
|
||||||
dispatch({type: Actions.CLEAR_SELECTION});
|
dispatch({type: Actions.CLEAR_SELECTION});
|
||||||
dispatch({type: Actions.NOTEBOOKS});
|
|
||||||
dispatch({type: Actions.NOTES});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const update = (note) => {
|
const update = (note) => {
|
||||||
@@ -97,7 +101,7 @@ const MoveNoteComponent = ({close, note, setNote}) => {
|
|||||||
});
|
});
|
||||||
notebookInput.current?.clear();
|
notebookInput.current?.clear();
|
||||||
notebookInput.current?.blur();
|
notebookInput.current?.blur();
|
||||||
dispatch({type: Actions.NOTEBOOKS});
|
Navigation.setRoutesToUpdate([Navigation.routeNames.Notebooks]);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addNewTopic = async () => {
|
const addNewTopic = async () => {
|
||||||
@@ -105,7 +109,7 @@ const MoveNoteComponent = ({close, note, setNote}) => {
|
|||||||
return ToastEvent.show('Title is required', 'error', 'local');
|
return ToastEvent.show('Title is required', 'error', 'local');
|
||||||
}
|
}
|
||||||
await db.notebooks.notebook(expanded).topics.add(newTopicTitle);
|
await db.notebooks.notebook(expanded).topics.add(newTopicTitle);
|
||||||
dispatch({type: Actions.NOTEBOOKS});
|
Navigation.setRoutesToUpdate([Navigation.routeNames.Notebooks]);
|
||||||
topicInput.current?.clear();
|
topicInput.current?.clear();
|
||||||
topicInput.current?.blur();
|
topicInput.current?.blur();
|
||||||
newTopicTitle = null;
|
newTopicTitle = null;
|
||||||
@@ -132,7 +136,7 @@ const MoveNoteComponent = ({close, note, setNote}) => {
|
|||||||
forced: true,
|
forced: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
dispatch({type: Actions.NOTEBOOKS});
|
Navigation.setRoutesToUpdate([Navigation.routeNames.Notebooks]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -155,7 +159,7 @@ const MoveNoteComponent = ({close, note, setNote}) => {
|
|||||||
forced: true,
|
forced: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
dispatch({type: Actions.NOTEBOOKS});
|
Navigation.setRoutesToUpdate([Navigation.routeNames.Notebooks]);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user