Skip to content

Commit f7fc6ff

Browse files
committed
Extended 'validationDelegate to remove List` topics
There is no scenario where we expect a `List` topic to be included in the navigation—or, generally, for the children of `List` topics to be included, and especially since a `List` cannot be navigated to. If we did, that would be a highly specialized scenario, and would necessitate a custom `validationDelegate()` to handle that logic. As such, we should strip `List` topics out of the default `MenuViewComponentBase<T>` so that they don't need to be explicitly filtered out at the view level, as they are today. (This also makes a minimal gain in terms of memory and performance since these unnecessary topics don't need to be mapped or cached in memory. That's likely negligible, of course.)
1 parent 2c5b687 commit f7fc6ff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

OnTopic.AspNetCore.Mvc/Components/MenuViewComponentBase{T}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ IHierarchicalTopicMappingService<T> hierarchicalTopicMappingService
102102
await HierarchicalTopicMappingService.GetRootViewModelAsync(
103103
navigationRootTopic!,
104104
3,
105-
t => t is not { Parent: { ContentType: "PageGroup" } }
105+
t => t is not { ContentType: "List" } and not { Parent: { ContentType: "PageGroup" } }
106106
).ConfigureAwait(false);
107107

108108
/*==========================================================================================================================

0 commit comments

Comments
 (0)