Skip to content

Commit 8367405

Browse files
committedMar 21, 2025·
Clear roots before rebuilding navigation dictionary.
1 parent 394210a commit 8367405

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎src/Umbraco.Core/Services/Navigation/ContentNavigationServiceBase.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,12 @@ public bool RestoreFromBin(Guid key, Guid? targetParentKey = null)
293293
/// <param name="readLock">The read lock value, should be -333 or -334 for content and media trees.</param>
294294
/// <param name="objectTypeKey">The key of the object type to rebuild.</param>
295295
/// <param name="trashed">Indicates whether the items are in the recycle bin.</param>
296-
protected async Task HandleRebuildAsync(int readLock, Guid objectTypeKey, bool trashed)
296+
protected Task HandleRebuildAsync(int readLock, Guid objectTypeKey, bool trashed)
297297
{
298298
// This is only relevant for items in the content and media trees
299299
if (readLock != Constants.Locks.ContentTree && readLock != Constants.Locks.MediaTree)
300300
{
301-
return;
301+
return Task.CompletedTask;
302302
}
303303

304304
using ICoreScope scope = _coreScopeProvider.CreateCoreScope(autoComplete: true);
@@ -307,14 +307,18 @@ protected async Task HandleRebuildAsync(int readLock, Guid objectTypeKey, bool t
307307
// Build the corresponding navigation structure
308308
if (trashed)
309309
{
310+
_recycleBinRoots.Clear();
310311
IEnumerable<INavigationModel> navigationModels = _navigationRepository.GetTrashedContentNodesByObjectType(objectTypeKey);
311312
BuildNavigationDictionary(_recycleBinNavigationStructure, _recycleBinRoots, navigationModels);
312313
}
313314
else
314315
{
316+
_roots.Clear();
315317
IEnumerable<INavigationModel> navigationModels = _navigationRepository.GetContentNodesByObjectType(objectTypeKey);
316318
BuildNavigationDictionary(_navigationStructure, _roots, navigationModels);
317319
}
320+
321+
return Task.CompletedTask;
318322
}
319323

320324
private bool TryGetParentKeyFromStructure(ConcurrentDictionary<Guid, NavigationNode> structure, Guid childKey, out Guid? parentKey)

0 commit comments

Comments
 (0)
Please sign in to comment.