prevented hierarchy to reresolbe on node click
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user