Improve store
This commit is contained in:
parent
624df90eda
commit
0ed387d9ba
|
@ -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[]>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue