diff --git a/packages/frontend-core/src/components/grid/stores/datasource.ts b/packages/frontend-core/src/components/grid/stores/datasource.ts index 17ce098555..c1757dd59e 100644 --- a/packages/frontend-core/src/components/grid/stores/datasource.ts +++ b/packages/frontend-core/src/components/grid/stores/datasource.ts @@ -131,7 +131,7 @@ export const deriveStores = (context: StoreContext): DerivedDatasourceStore => { ([$datasource, $definition]) => { let type = $datasource?.type if (type === "provider") { - type = $datasource.value?.datasource?.type + type = ($datasource as any).value?.datasource?.type } // Handle calculation views if (type === "viewV2" && $definition?.type === ViewV2Type.CALCULATION) { @@ -196,7 +196,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => { ) => { // Update local state const originalDefinition = get(definition) - definition.set(newDefinition) + definition.set(newDefinition as any) // Update server if (get(config).canSaveSchema) { @@ -229,8 +229,10 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => { newDefinition.schema[column].constraints = {} } newDefinition.schema[column].constraints.presence = { allowEmpty: false } - delete newDefinition.schema[column].default - return await saveDefinition(newDefinition) + if ("default" in newDefinition.schema[column]) { + delete newDefinition.schema[column].default + } + return await saveDefinition(newDefinition as any) } // Adds a schema mutation for a single field @@ -306,7 +308,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => { await saveDefinition({ ...$definition, schema: newSchema, - }) + } as any) resetSchemaMutations() } diff --git a/packages/frontend-core/src/components/grid/stores/index.ts b/packages/frontend-core/src/components/grid/stores/index.ts index d7d922f793..f2b6c973b9 100644 --- a/packages/frontend-core/src/components/grid/stores/index.ts +++ b/packages/frontend-core/src/components/grid/stores/index.ts @@ -62,9 +62,6 @@ export type Store = BaseStore & NonPlus.Store & Datasource.Store & { // TODO while typing the rest of stores - datasource: Writable & { actions: any } - definition: Writable - enrichedSchema: any fetch: Writable filter: Writable inlineFilters: Writable diff --git a/packages/types/src/ui/stores/grid/datasource.ts b/packages/types/src/ui/stores/grid/datasource.ts index ea6e8d1368..ec115d28a0 100644 --- a/packages/types/src/ui/stores/grid/datasource.ts +++ b/packages/types/src/ui/stores/grid/datasource.ts @@ -1,14 +1,16 @@ -import { SortOrder } from "@budibase/types" +import { SortOrder, UIFieldSchema } from "@budibase/types" export interface UIDatasource { type: string id: string tableId: string + primaryDisplay?: string sort?: { field: string order?: SortOrder } queryUI: any // TODO + schema: Record } export interface UIFieldMutation {