Improve store

This commit is contained in:
Adria Navarro 2024-12-20 12:35:09 +01:00
parent 624df90eda
commit 0ed387d9ba
2 changed files with 11 additions and 10 deletions

View File

@ -1,7 +1,7 @@
import { derived, get, Readable, Writable, writable } from "svelte/store"
import { DefaultColumnWidth, GutterWidth } from "../lib/constants"
import { CalculationType, FieldSchema } from "@budibase/types"
import { StoreContext } from "."
import { Store as StoreContext } from "."
export interface Store {
columns: Writable<Column[]>

View File

@ -50,7 +50,16 @@ const DependencyOrderedStores = [
Cache,
]
export const attachStores = context => {
export type Store = Columns.Store &
Columns.DerivedStore & {
// TODO while typing the rest of stores
datasource: any
definition: Writable<any>
displayColumn: Writable<any>
enrichedSchema: any
}
export const attachStores = (context): Store => {
// Atomic store creation
for (let store of DependencyOrderedStores) {
context = { ...context, ...store.createStores?.(context) }
@ -73,11 +82,3 @@ export const attachStores = context => {
return context
}
export interface StoreContext {
columns: Columns.Store["columns"]
datasource: any
definition: Writable<any>
displayColumn: Writable<any>
enrichedSchema: any
}