Skip to content

Commit a1deb15

Browse files
authored
Merge pull request #2651 from ZeroX-DG/fix-delete-note
Fixed delete note not navigating to the next note
2 parents 96ab8ec + 629d4a8 commit a1deb15

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

browser/main/NoteList/index.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -656,14 +656,18 @@ class NoteList extends React.Component {
656656
})
657657
)
658658
.then((data) => {
659-
data.forEach((item) => {
660-
dispatch({
661-
type: 'DELETE_NOTE',
662-
storageKey: item.storageKey,
663-
noteKey: item.noteKey
659+
const dispatchHandler = () => {
660+
data.forEach((item) => {
661+
dispatch({
662+
type: 'DELETE_NOTE',
663+
storageKey: item.storageKey,
664+
noteKey: item.noteKey
665+
})
664666
})
665-
})
667+
}
668+
ee.once('list:next', dispatchHandler)
666669
})
670+
.then(() => ee.emit('list:next'))
667671
.catch((err) => {
668672
console.error('Cannot Delete note: ' + err)
669673
})
@@ -687,6 +691,7 @@ class NoteList extends React.Component {
687691
})
688692
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('EDIT_NOTE')
689693
})
694+
.then(() => ee.emit('list:next'))
690695
.catch((err) => {
691696
console.error('Notes could not go to trash: ' + err)
692697
})

0 commit comments

Comments
 (0)