DashboardDataSource: Fixes issue where sometimes untransformed data could be returned (#87433)

* DashboardDataSource: always return a result key

* Update

* Update
This commit is contained in:
Torkel Ödegaard 2024-05-08 08:25:19 +02:00 committed by GitHub
parent d13e175328
commit e7c39f18be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -26,6 +26,16 @@ describe('DashboardDatasource', () => {
expect(rsp?.data[0].fields[0].values).toEqual([1, 2, 3]);
});
it('should always set response key', async () => {
const { observable } = setup({ refId: 'A', panelId: 1 });
let rsp: DataQueryResponse | undefined;
observable.subscribe({ next: (data) => (rsp = data) });
expect(rsp?.key).toEqual('source-ds-provider');
});
it('Can subscribe to panel data + transforms', async () => {
const { observable } = setup({ refId: 'A', panelId: 1, withTransforms: true });

View File

@ -76,6 +76,7 @@ export class DashboardDatasource extends DataSourceApi<DashboardQuery> {
state: result.data.state,
errors: result.data.errors,
error: result.data.error,
key: 'source-ds-provider',
};
}),
finalize(cleanUp)