From 0ed387d9ba4874ed7c9eecc84481d61030b4071f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 20 Dec 2024 12:35:09 +0100 Subject: [PATCH] Improve store --- .../src/components/grid/stores/columns.ts | 2 +- .../src/components/grid/stores/index.ts | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/frontend-core/src/components/grid/stores/columns.ts b/packages/frontend-core/src/components/grid/stores/columns.ts index 7831305e1b..9a85918d6d 100644 --- a/packages/frontend-core/src/components/grid/stores/columns.ts +++ b/packages/frontend-core/src/components/grid/stores/columns.ts @@ -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 diff --git a/packages/frontend-core/src/components/grid/stores/index.ts b/packages/frontend-core/src/components/grid/stores/index.ts index fdbd6b4f91..602dfa969a 100644 --- a/packages/frontend-core/src/components/grid/stores/index.ts +++ b/packages/frontend-core/src/components/grid/stores/index.ts @@ -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 + displayColumn: Writable + 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 - displayColumn: Writable - enrichedSchema: any -}