diff --git a/packages/frontend-core/src/components/grid/stores/index.ts b/packages/frontend-core/src/components/grid/stores/index.ts index 753266f893..d55002186f 100644 --- a/packages/frontend-core/src/components/grid/stores/index.ts +++ b/packages/frontend-core/src/components/grid/stores/index.ts @@ -98,7 +98,6 @@ export type Store = BaseStore & sort: Writable subscribe: any dispatch: (event: string, data: any) => any - notifications: Writable width: Writable bounds: Readable height: Readable @@ -108,7 +107,8 @@ export type Store = BaseStore & Config.Store & Conditions.Store & Cache.Store & - Viewport.Store + Viewport.Store & + Notifications.Store export const attachStores = (context: Store): Store => { // Atomic store creation diff --git a/packages/frontend-core/src/components/grid/stores/notifications.ts b/packages/frontend-core/src/components/grid/stores/notifications.ts index 05c8039704..429760ed50 100644 --- a/packages/frontend-core/src/components/grid/stores/notifications.ts +++ b/packages/frontend-core/src/components/grid/stores/notifications.ts @@ -1,8 +1,17 @@ import { notifications as BBUINotifications } from "@budibase/bbui" -import { derived } from "svelte/store" +import { derived, Readable } from "svelte/store" import { Store as StoreContext } from "." -export const createStores = (context: StoreContext) => { +interface NotificationStore { + notifications: Readable<{ + success: (message: string) => void + error: (message: string) => void + }> +} + +export type Store = NotificationStore + +export const createStores = (context: StoreContext): NotificationStore => { const { notifySuccess, notifyError } = context // Normally we would not derive a store in "createStores" as it should be