Fix definition types

This commit is contained in:
Adria Navarro 2024-12-30 10:58:07 +01:00
parent 9977c26ab4
commit fafa0472d7
2 changed files with 4 additions and 4 deletions

View File

@ -156,11 +156,11 @@ export const initialise = (context: StoreContext) => {
// Merge new schema fields with existing schema in order to preserve widths // Merge new schema fields with existing schema in order to preserve widths
const processColumns = ($enrichedSchema: any) => { const processColumns = ($enrichedSchema: any) => {
if (!$enrichedSchema) { const $definition = get(definition)
if (!$enrichedSchema || !$definition) {
columns.set([]) columns.set([])
return return
} }
const $definition = get(definition)
const $columns = get(columns) const $columns = get(columns)
const $displayColumn = get(displayColumn) const $displayColumn = get(displayColumn)

View File

@ -17,7 +17,7 @@ import { DatasourceActions } from "./datasources"
import { ConfigStore } from "./config" import { ConfigStore } from "./config"
interface DatasourceStore { interface DatasourceStore {
definition: Writable<UIDatasource> definition: Writable<UIDatasource | null>
schemaMutations: Writable<Record<string, UIFieldMutation>> schemaMutations: Writable<Record<string, UIFieldMutation>>
subSchemaMutations: Writable<Record<string, Record<string, UIFieldMutation>>> subSchemaMutations: Writable<Record<string, Record<string, UIFieldMutation>>>
} }
@ -219,7 +219,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => {
// Updates the datasources primary display column // Updates the datasources primary display column
const changePrimaryDisplay = async (column: string) => { const changePrimaryDisplay = async (column: string) => {
let newDefinition = cloneDeep(get(definition)) let newDefinition = cloneDeep(get(definition)!)
// Update primary display // Update primary display
newDefinition.primaryDisplay = column newDefinition.primaryDisplay = column