diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js index 8e4e2c404..0c7513309 100755 --- a/apps/mobile/src/views/Editor/index.js +++ b/apps/mobile/src/views/Editor/index.js @@ -265,9 +265,10 @@ const Editor = ({noMenu}) => { return true; }; - const setNoteInEditorAferSaving = (id, rId) => { - if (id !== rId) { - id = rId; + const setNoteInEditorAferSaving = (oldId, currentId) => { + console.log(oldId, currentId); + if (oldId !== currentId) { + id = currentId; note = db.notes.note(id); if (note) { note = note.data; @@ -295,15 +296,8 @@ const Editor = ({noMenu}) => { }, id: id, }); - setNoteInEditorAferSaving(id, rId); - if (id) { - await addToCollection(id); - dispatch({ - type: ACTIONS.CURRENT_EDITING_NOTE, - id: id, - }); - } + setNoteInEditorAferSaving(id, rId); if (content.text.length < 200 || saveCounter < 2) { dispatch({ @@ -312,11 +306,18 @@ const Editor = ({noMenu}) => { eSendEvent(refreshNotesPage); } - InfoBarRef.current?.setDateEdited( - db.notes.note(id).data.dateEdited, - content?.text?.split(' ').length, - ); - InfoBarRef.current?.setDateCreated(db.notes.note(id).data.dateCreated); + if (id) { + await addToCollection(id); + dispatch({ + type: ACTIONS.CURRENT_EDITING_NOTE, + id: id, + }); + InfoBarRef.current?.setDateEdited( + db.notes.note(id).data.dateEdited, + content?.text?.split(' ').length, + ); + InfoBarRef.current?.setDateCreated(db.notes.note(id).data.dateCreated); + } saveCounter++; } else { diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js index 8f70b8b6f..eb76fbfc1 100755 --- a/apps/mobile/src/views/Home/index.js +++ b/apps/mobile/src/views/Home/index.js @@ -5,7 +5,7 @@ import SelectionHeader from '../../components/SelectionHeader'; import {useTracked} from '../../provider'; import {ACTIONS} from '../../provider/actions'; import {eSendEvent} from '../../services/eventManager'; -import {DDS, ToastEvent} from '../../utils/utils'; +import {DDS, ToastEvent, db} from '../../utils/utils'; import {eScrollEvent, eOnLoadNote} from '../../services/events'; import {openEditorAnimation} from '../../utils/animations'; import {sideMenuRef} from '../../utils/refs';