File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -285,7 +285,8 @@ private async Task SyncSidebarItems(LocationItem section, IReadOnlyList<INavigat
285
285
{
286
286
for ( int i = 0 ; i < e . NewItems . Count ; i ++ )
287
287
{
288
- await AddElementToSection ( ( INavigationControlItem ) e . NewItems [ i ] , section , e . NewStartingIndex < 0 ? - 1 : i + e . NewStartingIndex ) ;
288
+ var index = e . NewStartingIndex < 0 ? - 1 : i + e . NewStartingIndex ;
289
+ await AddElementToSection ( ( INavigationControlItem ) e . NewItems [ i ] , section , index ) ;
289
290
}
290
291
break ;
291
292
}
@@ -295,7 +296,8 @@ private async Task SyncSidebarItems(LocationItem section, IReadOnlyList<INavigat
295
296
{
296
297
foreach ( INavigationControlItem elem in e . OldItems )
297
298
{
298
- section . ChildItems . Remove ( elem ) ;
299
+ var match = section . ChildItems . FirstOrDefault ( x => x . Path == elem . Path ) ;
300
+ section . ChildItems . Remove ( match ) ;
299
301
}
300
302
if ( e . Action != NotifyCollectionChangedAction . Remove )
301
303
{
@@ -309,10 +311,9 @@ private async Task SyncSidebarItems(LocationItem section, IReadOnlyList<INavigat
309
311
{
310
312
await AddElementToSection ( elem , section ) ;
311
313
}
312
-
313
314
foreach ( INavigationControlItem elem in section . ChildItems . ToList ( ) )
314
315
{
315
- if ( ! elements . Contains ( elem ) )
316
+ if ( ! elements . Any ( x => x . Path == elem . Path ) )
316
317
{
317
318
section . ChildItems . Remove ( elem ) ;
318
319
}
You can’t perform that action at this time.
0 commit comments