File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
packages/rxfire/firestore/collection Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -75,17 +75,21 @@ function processIndividualChange(
75
75
}
76
76
break ;
77
77
case 'modified' :
78
- // When an item changes position we first remove it
79
- // and then add it's new position
80
- if ( change . oldIndex !== change . newIndex ) {
81
- combined . splice ( change . oldIndex , 1 ) ;
82
- combined . splice ( change . newIndex , 0 , change ) ;
83
- } else {
84
- combined [ change . newIndex ] = change ;
78
+ if ( combined [ change . oldIndex ] == null || combined [ change . oldIndex ] . doc . id == change . doc . id ) {
79
+ // When an item changes position we first remove it
80
+ // and then add it's new position
81
+ if ( change . oldIndex !== change . newIndex ) {
82
+ combined . splice ( change . oldIndex , 1 ) ;
83
+ combined . splice ( change . newIndex , 0 , change ) ;
84
+ } else {
85
+ combined [ change . newIndex ] = change ;
86
+ }
85
87
}
86
88
break ;
87
89
case 'removed' :
88
- combined . splice ( change . oldIndex , 1 ) ;
90
+ if ( combined [ change . oldIndex ] && combined [ change . oldIndex ] . doc . id == change . doc . id ) {
91
+ combined . splice ( change . oldIndex , 1 ) ;
92
+ }
89
93
break ;
90
94
}
91
95
return combined ;
You can’t perform that action at this time.
0 commit comments