prevented hierarchy to reresolbe on node click

This commit is contained in:
2026-11-12 22:35:38 +01:00
parent 8b374681c2
commit 30eea4aa22
+20 -1
View File
@@ -284,7 +284,26 @@ export const routes: Routes = [
hierarchyData: hierarchyResolver,
suggestions: suggestionResolver,
},
runGuardsAndResolvers: 'always',
// Chart navigation only changes `path`/`lang`; do not refetch the whole
// hierarchy on every node click. An explicit same-URL reload (used by
// `reloadSuggestions`) still re-runs the resolvers.
runGuardsAndResolvers: (from, to) => {
if (from.routeConfig !== to.routeConfig) return true;
const keys = new Set([
...from.queryParamMap.keys,
...to.queryParamMap.keys,
]);
const changedKeys = [...keys].filter(
(key) => from.queryParamMap.get(key) !== to.queryParamMap.get(key),
);
// No query change at all -> explicit same-URL reload.
if (changedKeys.length === 0) return true;
// Only the chart's own state changed -> keep the loaded hierarchy.
return changedKeys.some((key) => key !== 'path' && key !== 'lang');
},
loadComponent: () =>
import('./modules/hierarchy/hierarchy.component').then(
(mod) => mod.HierarchyComponent,