1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop, Mobile: Immediately sort notes after toggling a checkbox

This commit is contained in:
Laurent Cozic 2024-02-19 23:09:34 +00:00
parent bfc31127af
commit 5820f63ea6
3 changed files with 8 additions and 1 deletions

View File

@ -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}
/>,
);
}

View File

@ -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<HTMLDivElement>) => {
@ -52,10 +54,12 @@ const NoteListItem = (props: NoteItemProps, ref: LegacyRef<HTMLDivElement>) => {
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);

View File

@ -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() {