DashboardDatasource: Debounce results slightly to avoid flickering on zoom (#102887)

Debounce all results slightly to avoid false positive DONE flickering
This commit is contained in:
Victor Marin
2025-05-05 20:20:31 +03:00
committed by GitHub
parent 2f397516e6
commit b9cb445148
2 changed files with 6 additions and 1 deletions
@@ -66,12 +66,16 @@ describe('DashboardDatasource', () => {
});
it('Can subscribe to panel data + transforms', async () => {
jest.useFakeTimers();
const { observable } = setup({ refId: 'A', panelId: 1, withTransforms: true });
let rsp: DataQueryResponse | undefined;
observable.subscribe({ next: (data) => (rsp = data) });
jest.runAllTimers();
expect(rsp?.data[0].fields[1].values).toEqual([3]);
});
@@ -1,4 +1,4 @@
import { Observable, debounce, defer, finalize, first, interval, map, of } from 'rxjs';
import { Observable, debounce, debounceTime, defer, finalize, first, interval, map, of } from 'rxjs';
import {
DataSourceApi,
@@ -79,6 +79,7 @@ export class DashboardDatasource extends DataSourceApi<DashboardQuery> {
const cleanUp = activateSceneObjectAndParentTree(sourceDataProvider!);
return sourceDataProvider!.getResultsStream!().pipe(
debounceTime(50),
map((result) => {
return {
data: this.getDataFramesForQueryTopic(result.data, query),