diff --git a/packages/frontend-core/src/components/grid/stores/columns.ts b/packages/frontend-core/src/components/grid/stores/columns.ts index 8073988323..70b93d93e6 100644 --- a/packages/frontend-core/src/components/grid/stores/columns.ts +++ b/packages/frontend-core/src/components/grid/stores/columns.ts @@ -156,11 +156,11 @@ export const initialise = (context: StoreContext) => { // Merge new schema fields with existing schema in order to preserve widths const processColumns = ($enrichedSchema: any) => { - if (!$enrichedSchema) { + const $definition = get(definition) + if (!$enrichedSchema || !$definition) { columns.set([]) return } - const $definition = get(definition) const $columns = get(columns) const $displayColumn = get(displayColumn) diff --git a/packages/frontend-core/src/components/grid/stores/datasource.ts b/packages/frontend-core/src/components/grid/stores/datasource.ts index d9dd2fb279..55af9c016a 100644 --- a/packages/frontend-core/src/components/grid/stores/datasource.ts +++ b/packages/frontend-core/src/components/grid/stores/datasource.ts @@ -17,7 +17,7 @@ import { DatasourceActions } from "./datasources" import { ConfigStore } from "./config" interface DatasourceStore { - definition: Writable + definition: Writable schemaMutations: Writable> subSchemaMutations: Writable>> } @@ -219,7 +219,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => { // Updates the datasources primary display column const changePrimaryDisplay = async (column: string) => { - let newDefinition = cloneDeep(get(definition)) + let newDefinition = cloneDeep(get(definition)!) // Update primary display newDefinition.primaryDisplay = column