You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-13 22:12:50 +02:00
Desktop: Fixes #3481: Crash when applying tags to multiple notes from within another tag
This commit is contained in:
@@ -295,6 +295,21 @@ function updateOneItem(state, action, keyName = '') {
|
||||
return newState;
|
||||
}
|
||||
|
||||
function updateSelectedNotesFromExistingNotes(state) {
|
||||
const newSelectedNoteIds = [];
|
||||
for (const selectedNoteId of state.selectedNoteIds) {
|
||||
for (const n of state.notes) {
|
||||
if (n.id === selectedNoteId) {
|
||||
newSelectedNoteIds.push(n.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Object.assign({}, state, {
|
||||
selectedNoteIds: newSelectedNoteIds,
|
||||
});
|
||||
}
|
||||
|
||||
function defaultNotesParentType(state, exclusion) {
|
||||
let newNotesParentType = null;
|
||||
|
||||
@@ -637,12 +652,12 @@ const reducer = (state = defaultState, action) => {
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// Replace all the notes with the provided array
|
||||
case 'NOTE_UPDATE_ALL':
|
||||
newState = Object.assign({}, state);
|
||||
newState.notes = action.notes;
|
||||
newState.notesSource = action.notesSource;
|
||||
newState = updateSelectedNotesFromExistingNotes(newState);
|
||||
break;
|
||||
|
||||
// Insert the note into the note list if it's new, or
|
||||
@@ -707,7 +722,6 @@ const reducer = (state = defaultState, action) => {
|
||||
newState.selectedNoteIds = newIndex >= 0 ? [newNotes[newIndex].id] : [];
|
||||
}
|
||||
|
||||
|
||||
if (action.provisional) {
|
||||
newState.provisionalNoteIds.push(modNote.id);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user