Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: grafana/scenes
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.5.1
Choose a base ref
...
head repository: grafana/scenes
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.5.2
Choose a head ref
  • 3 commits
  • 9 files changed
  • 2 contributors

Commits on Mar 20, 2025

  1. Scopes: Fix panels stuck in loading on scopes remove (#1079)

    mdvictor authored Mar 20, 2025

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dtzWill Will Dietz
    Copy the full SHA
    88f9073 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    11efa65 View commit details
  3. Copy the full SHA
    670cd9e View commit details
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# v6.5.2 (Thu Mar 20 2025)

#### 🐛 Bug Fix

- `@grafana/scenes`
- Scopes: Fix panels stuck in loading on scopes remove [#1079](https://github.com/grafana/scenes/pull/1079) ([@mdvictor](https://github.com/mdvictor))

#### Authors: 1

- Victor Marin ([@mdvictor](https://github.com/mdvictor))

---

# v6.5.1 (Thu Mar 20 2025)

#### 🐛 Bug Fix
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"npmClient": "yarn",
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "6.5.1",
"version": "6.5.2",
"packages": ["packages/*"]
}
2 changes: 1 addition & 1 deletion packages/scenes-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "scenes-app",
"private": true,
"version": "6.5.1",
"version": "6.5.2",
"author": "Grafana Labs",
"license": "AGPL-3.0-only",
"description": "A basic grafana app plugin",
2 changes: 1 addition & 1 deletion packages/scenes-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@grafana/scenes-react",
"version": "6.5.1",
"version": "6.5.2",
"description": "Grafana framework for building dynamic dashboards",
"author": "Grafana Labs",
"license": "AGPL-3.0-only",
12 changes: 12 additions & 0 deletions packages/scenes/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# v6.5.2 (Thu Mar 20 2025)

#### 🐛 Bug Fix

- Scopes: Fix panels stuck in loading on scopes remove [#1079](https://github.com/grafana/scenes/pull/1079) ([@mdvictor](https://github.com/mdvictor))

#### Authors: 1

- Victor Marin ([@mdvictor](https://github.com/mdvictor))

---

# v6.5.1 (Thu Mar 20 2025)

#### 🐛 Bug Fix
2 changes: 1 addition & 1 deletion packages/scenes/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@grafana/scenes",
"version": "6.5.1",
"version": "6.5.2",
"description": "Grafana framework for building dynamic dashboards",
"author": "Grafana Labs",
"license": "AGPL-3.0-only",
60 changes: 60 additions & 0 deletions packages/scenes/src/querying/SceneQueryRunner.test.ts
Original file line number Diff line number Diff line change
@@ -2634,6 +2634,66 @@ describe.each(['11.1.2', '11.1.1'])('SceneQueryRunner', (v) => {
getScopesBridgeSpy.mockReturnValue(undefined);
});

it('should run queries normaly when scopes are removed', async () => {
const queryRunner = new SceneQueryRunner({
queries: [{ refId: 'A' }],
$timeRange: new SceneTimeRange(),
});

const scopes = new SceneScopesBridge({});
let mockState = {
value: [
{
metadata: { name: 'Scope 1' },
spec: {
title: 'Scope 1',
type: 'test',
description: 'Test scope',
category: 'test',
filters: [],
},
},
],
drawerOpened: false,
enabled: true,
loading: false,
readOnly: false,
};

scopes.updateContext({
state: mockState,
stateObservable: new BehaviorSubject(mockState),
changeScopes: () => {},
setReadOnly: () => {},
setEnabled: () => {},
});

getScopesBridgeSpy.mockReturnValue(scopes);

// mimic removing scopes: no values, loading true
mockState = {
value: [],
drawerOpened: false,
enabled: true,
loading: true,
readOnly: false,
};

scopes.updateContext({
state: mockState,
stateObservable: new BehaviorSubject(mockState),
changeScopes: () => {},
setReadOnly: () => {},
setEnabled: () => {},
});

queryRunner.activate();
await new Promise((r) => setTimeout(r, 1));

expect(sentRequest?.scopes).toBeDefined();
expect(sentRequest?.scopes).toEqual([]);
});

it('should run queries with scopes when scopesBridge is provided', async () => {
const queryRunner = new SceneQueryRunner({
queries: [{ refId: 'A' }],
5 changes: 3 additions & 2 deletions packages/scenes/src/querying/SceneQueryRunner.ts
Original file line number Diff line number Diff line change
@@ -463,8 +463,9 @@ export class SceneQueryRunner extends SceneObjectBase<QueryRunnerState> implemen
return;
}

// Skip executing queries if scopes are in loading state
if (scopesBridge?.isLoading()) {
// Skip executing queries if scopes are in loading state and there are values, meaning further
// data will be received after scope filters are loaded
if (scopesBridge?.isLoading() && scopesBridge?.getValue().length) {
writeSceneLog('SceneQueryRunner', 'Scopes are in loading state, skipping query execution');
this.setState({ data: { ...(this.state.data ?? emptyPanelData), state: LoadingState.Loading } });
return;
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ exports[`SceneQueryRunner when running query should build DataQueryRequest objec
"from": "now-6h",
"to": "now",
},
"requestId": "SQR182",
"requestId": "SQR183",
"scopes": undefined,
"startTime": 1689063488000,
"targets": [