45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
# UNDF: UNDF-2026-000000090
|
|
--- a/public/app/features/variables/state/actions.ts
|
|
+++ b/public/app/features/variables/state/actions.ts
|
|
@@ -658,19 +658,19 @@ export interface OnTimeRangeUpdatedDependencies {
|
|
|
|
const dfs = (
|
|
node: Node,
|
|
- visited: string[],
|
|
+ visited: Set<string>,
|
|
variables: TypedVariableModel[],
|
|
variablesRefreshTimeRange: TypedVariableModel[]
|
|
) => {
|
|
- if (!visited.includes(node.name)) {
|
|
- visited.push(node.name);
|
|
+ if (!visited.has(node.name)) {
|
|
+ visited.add(node.name);
|
|
}
|
|
node.outputEdges.forEach((e) => {
|
|
const child = e.outputNode;
|
|
- if (child && !visited.includes(child.name)) {
|
|
+ if (child && !visited.has(child.name)) {
|
|
const childVariable = variables.find((v) => v.name === child.name) as QueryVariableModel;
|
|
if (
|
|
childVariable &&
|
|
childVariable.refresh === VariableRefresh.onTimeRangeChanged &&
|
|
variablesRefreshTimeRange.indexOf(childVariable) === -1
|
|
) {
|
|
variablesRefreshTimeRange.push(childVariable);
|
|
- visited.push(child.name);
|
|
+ visited.add(child.name);
|
|
} else {
|
|
dfs(child, visited, variables, variablesRefreshTimeRange);
|
|
}
|
|
@@ -718,7 +718,7 @@ export const getVariablesThatNeedRefreshNew = (key: string, state: StoreState):
|
|
const g = createGraph(allVariables);
|
|
// create a list of nodes that were visited
|
|
- const visitedDfs: string[] = [];
|
|
+ const visitedDfs = new Set<string>();
|
|
const variablesRefreshTimeRange: TypedVariableModel[] = [];
|
|
allVariables.forEach((v) => {
|
|
const node = g.getNode(v.name);
|
|
- if (visitedDfs.includes(v.name)) {
|
|
+ if (visitedDfs.has(v.name)) {
|
|
return;
|
|
}
|