@grafana/scenes 6.10.0--canary.1095.14616898973.0 → 6.10.0--canary.1095.14620012346.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -461,29 +461,18 @@ function useSceneObjectState(model, options) {
461
461
  return model.state;
462
462
  }
463
463
  function forEachChild(state, callback) {
464
- if (state.$behaviors) {
465
- state.$behaviors.forEach((behavior) => {
466
- if (behavior instanceof SceneObjectBase) {
467
- callback(behavior);
468
- }
469
- });
470
- }
471
- Object.keys(state).forEach((key) => {
472
- if (key === "$behaviors") {
473
- return;
474
- }
475
- const propValue = state[key];
464
+ for (const propValue of Object.values(state)) {
476
465
  if (propValue instanceof SceneObjectBase) {
477
466
  callback(propValue);
478
467
  }
479
468
  if (Array.isArray(propValue)) {
480
- propValue.forEach((child) => {
469
+ for (const child of propValue) {
481
470
  if (child instanceof SceneObjectBase) {
482
471
  callback(child);
483
472
  }
484
- });
473
+ }
485
474
  }
486
- });
475
+ }
487
476
  }
488
477
 
489
478
  function cloneSceneObject(sceneObject, withState) {
@@ -4309,9 +4298,6 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4309
4298
  }, [model, isAlwaysWip]);
4310
4299
  const handleMultiValueFilterCommit = React.useCallback(
4311
4300
  (model2, filter2, filterMultiValues2, preventFocus) => {
4312
- if (!filterMultiValues2.length && filter2.origin) {
4313
- model2.updateToMatchAll(filter2);
4314
- }
4315
4301
  if (filterMultiValues2.length) {
4316
4302
  const valueLabels = [];
4317
4303
  const values = [];
@@ -9685,31 +9671,31 @@ class SceneVariableSet extends SceneObjectBase {
9685
9671
  if (!this.parent) {
9686
9672
  return;
9687
9673
  }
9688
- const nodeQueue = [this.parent];
9689
- const hasChanged = this._variablesThatHaveChanged.has(variable);
9690
- while (nodeQueue.length > 0) {
9691
- const node = nodeQueue.shift();
9692
- let variableThatChanged = variable;
9693
- if (this === node) {
9694
- continue;
9695
- }
9696
- if (!node.isActive) {
9697
- continue;
9698
- }
9699
- if (node.state.$variables && node.state.$variables !== this) {
9700
- const localVar = node.state.$variables.getByName(variable.state.name);
9701
- if (localVar == null ? void 0 : localVar.isAncestorLoading) {
9702
- variableThatChanged = localVar;
9703
- } else if (localVar) {
9704
- return;
9705
- }
9706
- }
9707
- if (node.variableDependency) {
9708
- node.variableDependency.variableUpdateCompleted(variableThatChanged, hasChanged);
9674
+ this._traverseSceneAndNotify(this.parent, variable, this._variablesThatHaveChanged.has(variable));
9675
+ this._variablesThatHaveChanged.delete(variable);
9676
+ }
9677
+ /**
9678
+ * Recursivly walk the full scene object graph and notify all objects with dependencies that include any of changed variables
9679
+ */
9680
+ _traverseSceneAndNotify(sceneObject, variable, hasChanged) {
9681
+ if (this === sceneObject) {
9682
+ return;
9683
+ }
9684
+ if (!sceneObject.isActive) {
9685
+ return;
9686
+ }
9687
+ if (sceneObject.state.$variables && sceneObject.state.$variables !== this) {
9688
+ const localVar = sceneObject.state.$variables.getByName(variable.state.name);
9689
+ if (localVar == null ? void 0 : localVar.isAncestorLoading) {
9690
+ variable = localVar;
9691
+ } else if (localVar) {
9692
+ return;
9709
9693
  }
9710
- node.forEachChild((child) => nodeQueue.push(child));
9711
9694
  }
9712
- this._variablesThatHaveChanged.delete(variable);
9695
+ if (sceneObject.variableDependency) {
9696
+ sceneObject.variableDependency.variableUpdateCompleted(variable, hasChanged);
9697
+ }
9698
+ sceneObject.forEachChild((child) => this._traverseSceneAndNotify(child, variable, hasChanged));
9713
9699
  }
9714
9700
  /**
9715
9701
  * Return true if variable is waiting to update or currently updating.