github grafana/scenes v3.4.0

latest releases: v6.52.3, v6.52.2, v6.52.1...
23 months ago

Release Notes

VariableDependencyConfig: Support * to extract dependencies from every state path (#599)

Possible breaking change: VariableDependencyConfig default behavior

  • Previously: Using VariableDependencyConfig without options scanned the entire state.
  • Now: Default behavior requires an explicit wildcard (*) to scan the whole state. This prevents unintended dependency resolution.

Impact: If you intentionally scanned the entire state, use statePaths: ['*']. Otherwise, specify desired statePaths or variableNames.

Example:

class TestObj extends SceneObjectBase<TestState> {
  public constructor() {
    super({
      query: 'query with ${queryVarA} ${queryVarB}',
      otherProp: 'string with ${otherPropA}',
      nested: {
        query: 'nested object with ${nestedVarA}',
      },
    });
  }
}

it('Should be able to extract dependencies from all state', () => {
    const sceneObj = new TestObj();
-    const deps = new VariableDependencyConfig(sceneObj, {});
+    const deps = new VariableDependencyConfig(sceneObj, { statePaths: ['*'] });

    expect(deps.getNames()).toEqual(new Set(['queryVarA', 'queryVarB', 'nestedVarA', 'otherPropA']));
  });

This mproves performance and avoids unexpected dependency resolution.


🚀 Enhancement

  • @grafana/scenes
    • VariableDependencyConfig: Support * to extract dependencies from every state path #599 (@ivanortegaalba)

🐛 Bug Fix

Authors: 2

Don't miss a new scenes release

NewReleases is sending notifications on new releases.