Files
grafana/public/test/helpers/convertToStoreState.ts
Hugo Häggmark 20c700dd52 Chore: reduces barrel files part II (#107688)
* Chore: reduce barrel files

* chore: fixes unit test

* Chore: reduces barrel files part II

* chore: fix import sorting
2025-07-09 06:15:33 +02:00

16 lines
577 B
TypeScript

import { TypedVariableModel } from '@grafana/data';
import { getPreloadedState } from '../../app/features/variables/state/helpers';
import { VariablesState } from '../../app/features/variables/state/types';
import { StoreState } from '../../app/types/store';
export const convertToStoreState = (key: string, models: TypedVariableModel[]): StoreState => {
const variables = models.reduce<VariablesState>((byName, variable) => {
byName[variable.name] = variable;
return byName;
}, {});
return {
...getPreloadedState(key, { variables }),
} as StoreState;
};