diff --git a/packages/app-desktop/gui/NoteList/NoteList2.tsx b/packages/app-desktop/gui/NoteList/NoteList2.tsx index 51f70d102c4..2aace647bfd 100644 --- a/packages/app-desktop/gui/NoteList/NoteList2.tsx +++ b/packages/app-desktop/gui/NoteList/NoteList2.tsx @@ -208,6 +208,7 @@ const NoteList = (props: Props) => { isSelected={props.selectedNoteIds.includes(note.id)} isWatched={props.watchedNoteFiles.includes(note.id)} listRenderer={listRenderer} + dispatch={props.dispatch} />, ); } diff --git a/packages/app-desktop/gui/NoteListItem/NoteListItem.tsx b/packages/app-desktop/gui/NoteListItem/NoteListItem.tsx index dc2bbdcb2bb..6d230900acf 100644 --- a/packages/app-desktop/gui/NoteListItem/NoteListItem.tsx +++ b/packages/app-desktop/gui/NoteListItem/NoteListItem.tsx @@ -9,6 +9,7 @@ import { OnInputChange } from './utils/types'; import Note from '@joplin/lib/models/Note'; import { NoteEntity } from '@joplin/lib/services/database/types'; import useRenderedNote from './utils/useRenderedNote'; +import { Dispatch } from 'redux'; interface NoteItemProps { dragIndex: number; @@ -28,6 +29,7 @@ interface NoteItemProps { isSelected: boolean; isWatched: boolean; listRenderer: ListRenderer; + dispatch: Dispatch; } const NoteListItem = (props: NoteItemProps, ref: LegacyRef) => { @@ -52,10 +54,12 @@ const NoteListItem = (props: NoteItemProps, ref: LegacyRef) => { id: changeEvent.noteId, todo_completed: changeEvent.value ? Date.now() : 0, }, { userSideValidation: true }); + + props.dispatch({ type: 'NOTE_SORT' }); } else { if (props.onChange) await props.onChange(changeEvent); } - }, [props.onChange, noteId]); + }, [props.onChange, noteId, props.dispatch]); const rootElement = useRootElement(elementId); diff --git a/packages/app-mobile/components/note-item.js b/packages/app-mobile/components/note-item.js index 9f9c7d2c896..a99fd334ae7 100644 --- a/packages/app-mobile/components/note-item.js +++ b/packages/app-mobile/components/note-item.js @@ -75,6 +75,8 @@ class NoteItemComponent extends Component { todo_completed: checked ? time.unixMs() : 0, }; await Note.save(newNote); + + this.props.dispatch({ type: 'NOTE_SORT' }); } onPress() {