From 0c6df3dd734808cb5bcf4b0deb54c484ee9b26ac Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Thu, 21 Mar 2024 03:45:54 -0700 Subject: [PATCH] Mobile: Fixes #10170, #8779: Fix shared data lost if Joplin is closed immediately after receiving a share (#10171) --- packages/app-mobile/components/screens/Note.tsx | 3 --- packages/lib/components/shared/note-screen-shared.ts | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/app-mobile/components/screens/Note.tsx b/packages/app-mobile/components/screens/Note.tsx index 1b390d0cd..008b5e803 100644 --- a/packages/app-mobile/components/screens/Note.tsx +++ b/packages/app-mobile/components/screens/Note.tsx @@ -587,7 +587,6 @@ class NoteScreenComponent extends BaseScreenComponent implements B private title_changeText(text: string) { shared.noteComponent_change(this, 'title', text); this.setState({ newAndNoTitleChangeNoteId: null }); - this.scheduleSave(); } private onPlainEditorTextChange = (text: string) => { @@ -598,7 +597,6 @@ class NoteScreenComponent extends BaseScreenComponent implements B } shared.noteComponent_change(this, 'body', text); - this.scheduleSave(); }; // Avoid saving immediately -- the NoteEditor's content isn't controlled by its props @@ -607,7 +605,6 @@ class NoteScreenComponent extends BaseScreenComponent implements B // See https://github.com/laurent22/joplin/issues/10130 private onMarkdownEditorTextChange = debounce((event: EditorChangeEvent) => { shared.noteComponent_change(this, 'body', event.value); - this.scheduleSave(); }, 100); private onPlainEditorSelectionChange = (event: NativeSyntheticEvent) => { diff --git a/packages/lib/components/shared/note-screen-shared.ts b/packages/lib/components/shared/note-screen-shared.ts index dd5445330..9cbf324b5 100644 --- a/packages/lib/components/shared/note-screen-shared.ts +++ b/packages/lib/components/shared/note-screen-shared.ts @@ -17,6 +17,7 @@ export interface BaseNoteScreenComponent { state: any; setState: (newState: any)=> void; + scheduleSave(): void; scheduleFocusUpdate(): void; attachFile(asset: any, fileType: any): void; lastLoadedNoteId_?: string; @@ -185,6 +186,7 @@ shared.noteComponent_change = function(comp: BaseNoteScreenComponent, propName: newState.note = note; comp.setState(newState); + comp.scheduleSave(); }; let resourceCache_: any = {};