@grafana/scenes 6.1.5--canary.990.13570008543.0 → 6.1.5--canary.1071.13674684765.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.
Files changed (34) hide show
  1. package/dist/esm/components/SceneApp/SceneApp.js +3 -9
  2. package/dist/esm/components/SceneApp/SceneApp.js.map +1 -1
  3. package/dist/esm/components/SceneApp/SceneAppPage.js +0 -16
  4. package/dist/esm/components/SceneApp/SceneAppPage.js.map +1 -1
  5. package/dist/esm/core/sceneGraph/index.js +2 -3
  6. package/dist/esm/core/sceneGraph/index.js.map +1 -1
  7. package/dist/esm/core/sceneGraph/sceneGraph.js +1 -6
  8. package/dist/esm/core/sceneGraph/sceneGraph.js.map +1 -1
  9. package/dist/esm/index.js +0 -1
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/querying/SceneQueryRunner.js +8 -33
  12. package/dist/esm/querying/SceneQueryRunner.js.map +1 -1
  13. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js +4 -3
  14. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +1 -1
  15. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/utils.js +1 -22
  16. package/dist/esm/variables/adhoc/AdHocFiltersCombobox/utils.js.map +1 -1
  17. package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +4 -10
  18. package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
  19. package/dist/esm/variables/adhoc/getAdhocOptionSearcher.js +2 -3
  20. package/dist/esm/variables/adhoc/getAdhocOptionSearcher.js.map +1 -1
  21. package/dist/esm/variables/components/getOptionSearcher.js +2 -3
  22. package/dist/esm/variables/components/getOptionSearcher.js.map +1 -1
  23. package/dist/esm/variables/filter.js +35 -0
  24. package/dist/esm/variables/filter.js.map +1 -0
  25. package/dist/esm/variables/groupby/GroupByVariable.js +2 -3
  26. package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
  27. package/dist/esm/variables/utils.js +1 -23
  28. package/dist/esm/variables/utils.js.map +1 -1
  29. package/dist/index.d.ts +20 -66
  30. package/dist/index.js +54 -227
  31. package/dist/index.js.map +1 -1
  32. package/package.json +2 -2
  33. package/dist/esm/core/SceneScopesBridge.js +0 -111
  34. package/dist/esm/core/SceneScopesBridge.js.map +0 -1
package/dist/index.js CHANGED
@@ -13,9 +13,9 @@ var schema = require('@grafana/schema');
13
13
  var ui = require('@grafana/ui');
14
14
  var e2eSelectors = require('@grafana/e2e-selectors');
15
15
  var css = require('@emotion/css');
16
+ var uFuzzy = require('@leeoniya/ufuzzy');
16
17
  var react = require('@floating-ui/react');
17
18
  var reactVirtual = require('@tanstack/react-virtual');
18
- var uFuzzy = require('@leeoniya/ufuzzy');
19
19
  var reactUse = require('react-use');
20
20
  var operators = require('rxjs/operators');
21
21
  var ReactGridLayout = require('react-grid-layout');
@@ -2833,14 +2833,44 @@ function findActiveGroupByVariablesByUid(dsUid) {
2833
2833
  return void 0;
2834
2834
  }
2835
2835
 
2836
+ const REGEXP_NON_ASCII = /[^ -~]/m;
2837
+ const REGEXP_ONLY_SYMBOLS = /^[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+$/m;
2838
+ const outOfOrderLimit = 5;
2839
+ const maxNeedleLength = 25;
2840
+ const maxFuzzyTerms = 5;
2841
+ const rankThreshold = 1e4;
2842
+ const uf = new uFuzzy__default["default"]({ intraMode: 1 });
2843
+ function fuzzyFind(options, haystack, needle) {
2844
+ let matches = [];
2845
+ if (needle === "") {
2846
+ matches = options;
2847
+ } else if (REGEXP_NON_ASCII.test(needle) || REGEXP_ONLY_SYMBOLS.test(needle) || needle.length > maxNeedleLength || uf.split(needle).length > maxFuzzyTerms) {
2848
+ for (let i = 0; i < haystack.length; i++) {
2849
+ let item = haystack[i];
2850
+ if (item.includes(needle)) {
2851
+ matches.push(options[i]);
2852
+ }
2853
+ }
2854
+ } else {
2855
+ const [idxs, info, order] = uf.search(haystack, needle, outOfOrderLimit, rankThreshold);
2856
+ if (idxs == null ? void 0 : idxs.length) {
2857
+ if (info && order) {
2858
+ matches = order.map((idx) => options[info.idx[idx]]);
2859
+ } else {
2860
+ matches = idxs.map((idx) => options[idx]);
2861
+ }
2862
+ }
2863
+ }
2864
+ return matches;
2865
+ }
2866
+
2836
2867
  function getOptionSearcher(options, includeAll = false) {
2837
2868
  let allOptions = options;
2838
2869
  if (includeAll) {
2839
2870
  allOptions = [{ value: ALL_VARIABLE_VALUE, label: ALL_VARIABLE_TEXT }, ...allOptions];
2840
2871
  }
2841
2872
  const haystack = allOptions.map((o) => o.label);
2842
- const fuzzySearch = getFuzzySearcher(haystack);
2843
- return (search) => fuzzySearch(search).map((i) => allOptions[i]);
2873
+ return (search) => fuzzyFind(allOptions, haystack, search);
2844
2874
  }
2845
2875
 
2846
2876
  var __defProp$G = Object.defineProperty;
@@ -3233,7 +3263,7 @@ class GroupByVariable extends MultiValueVariable {
3233
3263
  this.isLazy = true;
3234
3264
  this._urlSync = new GroupByVariableUrlSyncHandler(this);
3235
3265
  this._getKeys = async (ds) => {
3236
- var _a, _b, _c, _d;
3266
+ var _a, _b, _c;
3237
3267
  const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, null));
3238
3268
  if (override && override.replace) {
3239
3269
  return override.values;
@@ -3250,8 +3280,7 @@ class GroupByVariable extends MultiValueVariable {
3250
3280
  const response = await ds.getTagKeys(__spreadValues$F({
3251
3281
  filters: otherFilters,
3252
3282
  queries,
3253
- timeRange,
3254
- scopes: (_d = this._scopesBridge) == null ? void 0 : _d.getValue()
3283
+ timeRange
3255
3284
  }, getEnrichedFiltersRequest(this)));
3256
3285
  if (responseHasError(response)) {
3257
3286
  this.setState({ error: response.error.message });
@@ -3605,8 +3634,7 @@ function getAdhocOptionSearcher(options) {
3605
3634
  var _a;
3606
3635
  return (_a = o.label) != null ? _a : String(o.value);
3607
3636
  });
3608
- const fuzzySearch = getFuzzySearcher(haystack);
3609
- return (search) => fuzzySearch(search).map((i) => options[i]);
3637
+ return (search) => fuzzyFind(options, haystack, search);
3610
3638
  }
3611
3639
 
3612
3640
  var __defProp$E = Object.defineProperty;
@@ -4142,26 +4170,6 @@ const VIRTUAL_LIST_OVERSCAN = 5;
4142
4170
  const VIRTUAL_LIST_ITEM_HEIGHT = 38;
4143
4171
  const VIRTUAL_LIST_ITEM_HEIGHT_WITH_DESCRIPTION = 60;
4144
4172
  const ERROR_STATE_DROPDOWN_WIDTH = 366;
4145
- const REGEXP_NON_ASCII = /[^ -~]/m;
4146
- function searchOptions(options) {
4147
- const haystack = options.map((o) => {
4148
- var _a;
4149
- return (_a = o.label) != null ? _a : o.value;
4150
- });
4151
- const fuzzySearch = getFuzzySearcher(haystack);
4152
- return (search, filterInputType) => {
4153
- if (REGEXP_NON_ASCII.test(search)) {
4154
- return options.filter((o) => {
4155
- var _a, _b;
4156
- return ((_a = o.label) == null ? void 0 : _a.includes(search)) || ((_b = o.value) == null ? void 0 : _b.includes(search)) || false;
4157
- });
4158
- }
4159
- if (filterInputType === "operator" && search !== "") {
4160
- search = `"${search}"`;
4161
- }
4162
- return fuzzySearch(search).map((i) => options[i]);
4163
- };
4164
- }
4165
4173
  const flattenOptionGroups = (options) => options.flatMap((option) => option.options ? [option, ...option.options] : [option]);
4166
4174
  const setupDropdownAccessibility = (options, listRef, disabledIndicesRef) => {
4167
4175
  var _a, _b, _c, _d;
@@ -4501,7 +4509,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4501
4509
  const listRef = React.useRef([]);
4502
4510
  const disabledIndicesRef = React.useRef([]);
4503
4511
  const filterInputTypeRef = React.useRef(!isAlwaysWip ? "value" : "key");
4504
- const optionsSearcher = React.useMemo(() => searchOptions(options), [options]);
4512
+ const optionsSearcher = React.useMemo(() => getAdhocOptionSearcher(options), [options]);
4505
4513
  const isLastFilter = React.useMemo(() => {
4506
4514
  if (isAlwaysWip) {
4507
4515
  return false;
@@ -4610,7 +4618,7 @@ const AdHocCombobox = React.forwardRef(function AdHocCombobox2({ filter, model,
4610
4618
  [refs.domReference]
4611
4619
  );
4612
4620
  const filteredDropDownItems = flattenOptionGroups(
4613
- handleOptionGroups(optionsSearcher(preventFiltering ? "" : inputValue, filterInputType))
4621
+ handleOptionGroups(optionsSearcher(preventFiltering ? "" : inputValue))
4614
4622
  );
4615
4623
  if (allowCustomValue && filterInputType !== "operator" && inputValue) {
4616
4624
  filteredDropDownItems.push({
@@ -5407,13 +5415,9 @@ class AdHocFiltersVariable extends SceneObjectBase {
5407
5415
  this._scopedVars = { __sceneObject: wrapInSafeSerializableSceneObject(this) };
5408
5416
  this._dataSourceSrv = runtime.getDataSourceSrv();
5409
5417
  this._urlSync = new AdHocFiltersVariableUrlSyncHandler(this);
5410
- this._activationHandler = () => {
5411
- this._scopesBridge = sceneGraph.getScopesBridge(this);
5412
- };
5413
5418
  if (this.state.applyMode === "auto") {
5414
5419
  patchGetAdhocFilters(this);
5415
5420
  }
5416
- this.addActivationHandler(this._activationHandler);
5417
5421
  }
5418
5422
  setState(update) {
5419
5423
  let filterExpressionChanged = false;
@@ -5497,7 +5501,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
5497
5501
  }
5498
5502
  }
5499
5503
  async _getKeys(currentKey) {
5500
- var _a, _b, _c, _d;
5504
+ var _a, _b, _c;
5501
5505
  const override = await ((_b = (_a = this.state).getTagKeysProvider) == null ? void 0 : _b.call(_a, this, currentKey));
5502
5506
  if (override && override.replace) {
5503
5507
  return dataFromResponse(override.values).map(toSelectableValue);
@@ -5515,8 +5519,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
5515
5519
  const response = await ds.getTagKeys(__spreadValues$z({
5516
5520
  filters: otherFilters,
5517
5521
  queries,
5518
- timeRange,
5519
- scopes: (_d = this._scopesBridge) == null ? void 0 : _d.getValue()
5522
+ timeRange
5520
5523
  }, getEnrichedFiltersRequest(this)));
5521
5524
  if (responseHasError(response)) {
5522
5525
  this.setState({ error: response.error.message });
@@ -5532,7 +5535,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
5532
5535
  return keys.map(toSelectableValue);
5533
5536
  }
5534
5537
  async _getValuesFor(filter) {
5535
- var _a, _b, _c, _d;
5538
+ var _a, _b, _c;
5536
5539
  const override = await ((_b = (_a = this.state).getTagValuesProvider) == null ? void 0 : _b.call(_a, this, filter));
5537
5540
  if (override && override.replace) {
5538
5541
  return dataFromResponse(override.values).map(toSelectableValue);
@@ -5548,8 +5551,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
5548
5551
  key: filter.key,
5549
5552
  filters: otherFilters,
5550
5553
  timeRange,
5551
- queries,
5552
- scopes: (_d = this._scopesBridge) == null ? void 0 : _d.getValue()
5554
+ queries
5553
5555
  }, getEnrichedFiltersRequest(this)));
5554
5556
  if (responseHasError(response)) {
5555
5557
  this.setState({ error: response.error.message });
@@ -5737,7 +5739,6 @@ class SceneQueryRunner extends SceneObjectBase {
5737
5739
  _onActivate() {
5738
5740
  if (this.isQueryModeAuto()) {
5739
5741
  const timeRange = sceneGraph.getTimeRange(this);
5740
- const scopesBridge = sceneGraph.getScopesBridge(this);
5741
5742
  const providers = this.getClosestExtraQueryProviders();
5742
5743
  for (const provider of providers) {
5743
5744
  this._subs.add(
@@ -5748,7 +5749,6 @@ class SceneQueryRunner extends SceneObjectBase {
5748
5749
  })
5749
5750
  );
5750
5751
  }
5751
- this.subscribeToScopesChanges(scopesBridge);
5752
5752
  this.subscribeToTimeRangeChanges(timeRange);
5753
5753
  if (this.shouldRunQueriesOnActivate()) {
5754
5754
  this.runQueries();
@@ -5894,21 +5894,6 @@ class SceneQueryRunner extends SceneObjectBase {
5894
5894
  isDataReadyToDisplay() {
5895
5895
  return Boolean(this.state._hasFetchedData);
5896
5896
  }
5897
- subscribeToScopesChanges(scopesBridge) {
5898
- if (!scopesBridge) {
5899
- return;
5900
- }
5901
- if (this._scopesSubBridge === scopesBridge) {
5902
- return;
5903
- }
5904
- if (this._scopesSub) {
5905
- this._scopesSub.unsubscribe();
5906
- }
5907
- this._scopesSubBridge = scopesBridge;
5908
- this._scopesSub = scopesBridge.subscribeToValue(() => {
5909
- this.runWithTimeRangeAndScopes(sceneGraph.getTimeRange(this), scopesBridge);
5910
- });
5911
- }
5912
5897
  subscribeToTimeRangeChanges(timeRange) {
5913
5898
  if (this._timeSubRange === timeRange) {
5914
5899
  return;
@@ -5918,17 +5903,15 @@ class SceneQueryRunner extends SceneObjectBase {
5918
5903
  }
5919
5904
  this._timeSubRange = timeRange;
5920
5905
  this._timeSub = timeRange.subscribeToState(() => {
5921
- this.runWithTimeRangeAndScopes(timeRange, sceneGraph.getScopesBridge(this));
5906
+ this.runWithTimeRange(timeRange);
5922
5907
  });
5923
5908
  }
5924
5909
  runQueries() {
5925
5910
  const timeRange = sceneGraph.getTimeRange(this);
5926
- const scopesBridge = sceneGraph.getScopesBridge(this);
5927
5911
  if (this.isQueryModeAuto()) {
5928
5912
  this.subscribeToTimeRangeChanges(timeRange);
5929
- this.subscribeToScopesChanges(scopesBridge);
5930
5913
  }
5931
- this.runWithTimeRangeAndScopes(timeRange, scopesBridge);
5914
+ this.runWithTimeRange(timeRange);
5932
5915
  }
5933
5916
  getMaxDataPoints() {
5934
5917
  var _a;
@@ -5948,8 +5931,8 @@ class SceneQueryRunner extends SceneObjectBase {
5948
5931
  data: __spreadProps$m(__spreadValues$y({}, this.state.data), { state: schema.LoadingState.Done })
5949
5932
  });
5950
5933
  }
5951
- async runWithTimeRangeAndScopes(timeRange, scopesBridge) {
5952
- var _a, _b, _c, _d;
5934
+ async runWithTimeRange(timeRange) {
5935
+ var _a, _b, _c;
5953
5936
  if (!this.state.maxDataPoints && this.state.maxDataPointsFromWidth && !this._containerWidth) {
5954
5937
  return;
5955
5938
  }
@@ -5962,22 +5945,17 @@ class SceneQueryRunner extends SceneObjectBase {
5962
5945
  this.setState({ data: __spreadProps$m(__spreadValues$y({}, (_b = this.state.data) != null ? _b : emptyPanelData), { state: schema.LoadingState.Loading }) });
5963
5946
  return;
5964
5947
  }
5965
- if (scopesBridge == null ? void 0 : scopesBridge.isLoading()) {
5966
- writeSceneLog("SceneQueryRunner", "Scopes are in loading state, skipping query execution");
5967
- this.setState({ data: __spreadProps$m(__spreadValues$y({}, (_c = this.state.data) != null ? _c : emptyPanelData), { state: schema.LoadingState.Loading }) });
5968
- return;
5969
- }
5970
5948
  const { queries } = this.state;
5971
5949
  if (!(queries == null ? void 0 : queries.length)) {
5972
5950
  this._setNoDataState();
5973
5951
  return;
5974
5952
  }
5975
5953
  try {
5976
- const datasource = (_d = this.state.datasource) != null ? _d : findFirstDatasource(queries);
5954
+ const datasource = (_c = this.state.datasource) != null ? _c : findFirstDatasource(queries);
5977
5955
  const ds = await getDataSource(datasource, this._scopedVars);
5978
5956
  this.findAndSubscribeToAdHocFilters(ds.uid);
5979
5957
  const runRequest = runtime.getRunRequest();
5980
- const { primary, secondaries, processors } = this.prepareRequests(timeRange, ds, scopesBridge);
5958
+ const { primary, secondaries, processors } = this.prepareRequests(timeRange, ds);
5981
5959
  writeSceneLog("SceneQueryRunner", "Starting runRequest", this.state.key);
5982
5960
  let stream = runRequest(ds, primary);
5983
5961
  if (secondaries.length > 0) {
@@ -6016,7 +5994,7 @@ class SceneQueryRunner extends SceneObjectBase {
6016
5994
  clone["_results"].next({ origin: this, data: (_a = this.state.data) != null ? _a : emptyPanelData });
6017
5995
  return clone;
6018
5996
  }
6019
- prepareRequests(timeRange, ds, scopesBridge) {
5997
+ prepareRequests(timeRange, ds) {
6020
5998
  var _a, _b;
6021
5999
  const { minInterval, queries } = this.state;
6022
6000
  let request = __spreadValues$y({
@@ -6036,8 +6014,7 @@ class SceneQueryRunner extends SceneObjectBase {
6036
6014
  to: timeRange.state.to
6037
6015
  },
6038
6016
  cacheTimeout: this.state.cacheTimeout,
6039
- queryCachingTTL: this.state.queryCachingTTL,
6040
- scopes: scopesBridge == null ? void 0 : scopesBridge.getValue()
6017
+ queryCachingTTL: this.state.queryCachingTTL
6041
6018
  }, getEnrichedDataRequest(this));
6042
6019
  if (this._adhocFiltersVar) {
6043
6020
  request.filters = [];
@@ -6310,27 +6287,6 @@ function handleOptionGroups(values) {
6310
6287
  }
6311
6288
  return result;
6312
6289
  }
6313
- function getFuzzySearcher(haystack, limit = 1e4) {
6314
- const ufuzzy = new uFuzzy__default["default"]();
6315
- const FIRST = Array.from({ length: Math.min(limit, haystack.length) }, (_, i) => i);
6316
- return (search) => {
6317
- if (search === "") {
6318
- return FIRST;
6319
- }
6320
- const [idxs, info, order] = ufuzzy.search(haystack, search);
6321
- if (idxs) {
6322
- if (info && order) {
6323
- const outIdxs = Array(Math.min(order.length, limit));
6324
- for (let i = 0; i < outIdxs.length; i++) {
6325
- outIdxs[i] = info.idx[order[i]];
6326
- }
6327
- return outIdxs;
6328
- }
6329
- return idxs.slice(0, limit);
6330
- }
6331
- return [];
6332
- };
6333
- }
6334
6290
 
6335
6291
  var __defProp$x = Object.defineProperty;
6336
6292
  var __defProps$l = Object.defineProperties;
@@ -7010,108 +6966,6 @@ function containsSearchFilter(query) {
7010
6966
  return str.indexOf(SEARCH_FILTER_VARIABLE) > -1;
7011
6967
  }
7012
6968
 
7013
- class SceneScopesBridge extends SceneObjectBase {
7014
- constructor() {
7015
- super(...arguments);
7016
- this._urlSync = new SceneObjectUrlSyncConfig(this, { keys: ["scopes"] });
7017
- this._renderBeforeActivation = true;
7018
- this._contextSubject = new rxjs.BehaviorSubject(void 0);
7019
- this._pendingScopes = null;
7020
- }
7021
- getUrlState() {
7022
- var _a, _b, _c;
7023
- return {
7024
- scopes: (_c = this._pendingScopes) != null ? _c : ((_b = (_a = this.context) == null ? void 0 : _a.state.value) != null ? _b : []).map((scope) => scope.metadata.name)
7025
- };
7026
- }
7027
- updateFromUrl(values) {
7028
- var _a, _b;
7029
- let scopes = (_a = values["scopes"]) != null ? _a : [];
7030
- scopes = (Array.isArray(scopes) ? scopes : [scopes]).map(String);
7031
- if (!this.context) {
7032
- this._pendingScopes = scopes;
7033
- return;
7034
- }
7035
- (_b = this.context) == null ? void 0 : _b.changeScopes(scopes);
7036
- }
7037
- getValue() {
7038
- var _a, _b;
7039
- return (_b = (_a = this.context) == null ? void 0 : _a.state.value) != null ? _b : [];
7040
- }
7041
- subscribeToValue(cb) {
7042
- return this.contextObservable.pipe(
7043
- rxjs.filter((context) => !!context && !context.state.loading),
7044
- rxjs.pairwise(),
7045
- rxjs.map(
7046
- ([prevContext, newContext]) => {
7047
- var _a, _b;
7048
- return [(_a = prevContext == null ? void 0 : prevContext.state.value) != null ? _a : [], (_b = newContext == null ? void 0 : newContext.state.value) != null ? _b : []];
7049
- }
7050
- ),
7051
- rxjs.filter(([prevScopes, newScopes]) => !lodash.isEqual(prevScopes, newScopes))
7052
- ).subscribe(([prevScopes, newScopes]) => {
7053
- cb(newScopes, prevScopes);
7054
- });
7055
- }
7056
- isLoading() {
7057
- var _a, _b;
7058
- return (_b = (_a = this.context) == null ? void 0 : _a.state.loading) != null ? _b : false;
7059
- }
7060
- subscribeToLoading(cb) {
7061
- return this.contextObservable.pipe(
7062
- rxjs.filter((context) => !!context),
7063
- rxjs.pairwise(),
7064
- rxjs.map(
7065
- ([prevContext, newContext]) => {
7066
- var _a, _b;
7067
- return [(_a = prevContext == null ? void 0 : prevContext.state.loading) != null ? _a : false, (_b = newContext == null ? void 0 : newContext.state.loading) != null ? _b : false];
7068
- }
7069
- ),
7070
- rxjs.filter(([prevLoading, newLoading]) => prevLoading !== newLoading)
7071
- ).subscribe(([_prevLoading, newLoading]) => {
7072
- cb(newLoading);
7073
- });
7074
- }
7075
- setEnabled(enabled) {
7076
- var _a;
7077
- (_a = this.context) == null ? void 0 : _a.setEnabled(enabled);
7078
- }
7079
- setReadOnly(readOnly) {
7080
- var _a;
7081
- (_a = this.context) == null ? void 0 : _a.setReadOnly(readOnly);
7082
- }
7083
- updateContext(newContext) {
7084
- var _a, _b;
7085
- if (this._pendingScopes && newContext) {
7086
- setTimeout(() => {
7087
- newContext == null ? void 0 : newContext.changeScopes(this._pendingScopes);
7088
- this._pendingScopes = null;
7089
- });
7090
- }
7091
- if (this.context !== newContext || ((_a = this.context) == null ? void 0 : _a.state) !== (newContext == null ? void 0 : newContext.state)) {
7092
- const shouldUpdate = ((_b = this.context) == null ? void 0 : _b.state.value) !== (newContext == null ? void 0 : newContext.state.value);
7093
- this._contextSubject.next(newContext);
7094
- if (shouldUpdate) {
7095
- this.forceRender();
7096
- }
7097
- }
7098
- }
7099
- get context() {
7100
- return this._contextSubject.getValue();
7101
- }
7102
- get contextObservable() {
7103
- return this._contextSubject.asObservable();
7104
- }
7105
- }
7106
- SceneScopesBridge.Component = SceneScopesBridgeRenderer;
7107
- function SceneScopesBridgeRenderer({ model }) {
7108
- const context = runtime.useScopes();
7109
- React.useEffect(() => {
7110
- model.updateContext(context);
7111
- }, [context, model]);
7112
- return null;
7113
- }
7114
-
7115
6969
  function getVariables(sceneObject) {
7116
6970
  var _a;
7117
6971
  return (_a = getClosest(sceneObject, (s) => s.state.$variables)) != null ? _a : EmptyVariableSet;
@@ -7255,10 +7109,6 @@ function findDescendents(scene, descendentType) {
7255
7109
  const targetScenes = findAllObjects(scene, isDescendentType);
7256
7110
  return targetScenes.filter(isDescendentType);
7257
7111
  }
7258
- function getScopesBridge(sceneObject) {
7259
- var _a;
7260
- return (_a = findObject(sceneObject, (s) => s instanceof SceneScopesBridge)) != null ? _a : void 0;
7261
- }
7262
7112
 
7263
7113
  const sceneGraph = {
7264
7114
  getVariables,
@@ -7275,8 +7125,7 @@ const sceneGraph = {
7275
7125
  findAllObjects,
7276
7126
  getAncestor,
7277
7127
  getQueryController,
7278
- findDescendents,
7279
- getScopesBridge
7128
+ findDescendents
7280
7129
  };
7281
7130
 
7282
7131
  class UniqueUrlKeyMapper {
@@ -13030,10 +12879,6 @@ class SplitLayout extends SceneObjectBase {
13030
12879
  SplitLayout.Component = SplitLayoutRenderer;
13031
12880
 
13032
12881
  class SceneApp extends SceneObjectBase {
13033
- constructor() {
13034
- super(...arguments);
13035
- this._renderBeforeActivation = true;
13036
- }
13037
12882
  enrichDataRequest() {
13038
12883
  return {
13039
12884
  app: this.state.name || "app"
@@ -13041,10 +12886,8 @@ class SceneApp extends SceneObjectBase {
13041
12886
  }
13042
12887
  }
13043
12888
  SceneApp.Component = ({ model }) => {
13044
- const { pages, scopesBridge } = model.useState();
13045
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, scopesBridge && /* @__PURE__ */ React__default["default"].createElement(scopesBridge.Component, {
13046
- model: scopesBridge
13047
- }), /* @__PURE__ */ React__default["default"].createElement(SceneAppContext.Provider, {
12889
+ const { pages } = model.useState();
12890
+ return /* @__PURE__ */ React__default["default"].createElement(SceneAppContext.Provider, {
13048
12891
  value: model
13049
12892
  }, /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Routes, null, pages.map((page) => /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Route, {
13050
12893
  key: page.state.url,
@@ -13052,7 +12895,7 @@ SceneApp.Component = ({ model }) => {
13052
12895
  element: /* @__PURE__ */ React__default["default"].createElement(page.Component, {
13053
12896
  model: page
13054
12897
  })
13055
- })))));
12898
+ }))));
13056
12899
  };
13057
12900
  const SceneAppContext = React.createContext(null);
13058
12901
  const sceneAppCache = /* @__PURE__ */ new Map();
@@ -13407,21 +13250,6 @@ class SceneAppPage extends SceneObjectBase {
13407
13250
  super(state);
13408
13251
  this._sceneCache = /* @__PURE__ */ new Map();
13409
13252
  this._drilldownCache = /* @__PURE__ */ new Map();
13410
- this._activationHandler = () => {
13411
- if (!this.state.useScopes) {
13412
- return;
13413
- }
13414
- this._scopesBridge = sceneGraph.getScopesBridge(this);
13415
- if (!this._scopesBridge) {
13416
- throw new Error("Use of scopes is enabled but no scopes bridge found");
13417
- }
13418
- this._scopesBridge.setEnabled(true);
13419
- return () => {
13420
- var _a;
13421
- (_a = this._scopesBridge) == null ? void 0 : _a.setEnabled(false);
13422
- };
13423
- };
13424
- this.addActivationHandler(this._activationHandler);
13425
13253
  }
13426
13254
  initializeScene(scene) {
13427
13255
  this.setState({ initializedScene: scene });
@@ -14421,7 +14249,6 @@ exports.SceneObjectUrlSyncConfig = SceneObjectUrlSyncConfig;
14421
14249
  exports.SceneQueryRunner = SceneQueryRunner;
14422
14250
  exports.SceneReactObject = SceneReactObject;
14423
14251
  exports.SceneRefreshPicker = SceneRefreshPicker;
14424
- exports.SceneScopesBridge = SceneScopesBridge;
14425
14252
  exports.SceneTimePicker = SceneTimePicker;
14426
14253
  exports.SceneTimeRange = SceneTimeRange;
14427
14254
  exports.SceneTimeRangeCompare = SceneTimeRangeCompare;