diff --git a/packages/builder/src/stores/builder/theme.ts b/packages/builder/src/stores/builder/theme.ts index b3ac202a5d..f2675fe06b 100644 --- a/packages/builder/src/stores/builder/theme.ts +++ b/packages/builder/src/stores/builder/theme.ts @@ -19,10 +19,7 @@ export class ThemeStore extends BudiStore { syncAppTheme = (app: App) => { this.update(state => { - const theme = ensureValidTheme( - app.theme as Theme | undefined, - DefaultAppTheme - ) as Theme + const theme = ensureValidTheme(app.theme, DefaultAppTheme) return { ...state, theme, @@ -35,10 +32,7 @@ export class ThemeStore extends BudiStore { const app = await API.saveAppMetadata(appId, { theme }) this.update(state => ({ ...state, - theme: ensureValidTheme( - app.theme as Theme | undefined, - DefaultAppTheme - ) as Theme, + theme: ensureValidTheme(app.theme, DefaultAppTheme), })) } @@ -55,10 +49,7 @@ export class ThemeStore extends BudiStore { const { theme, customTheme } = metadata this.update(state => ({ ...state, - theme: ensureValidTheme( - theme as Theme | undefined, - DefaultAppTheme - ) as Theme, + theme: ensureValidTheme(theme, DefaultAppTheme), customTheme: customTheme || {}, })) } diff --git a/packages/types/src/documents/app/app.ts b/packages/types/src/documents/app/app.ts index e31dd1e9ac..7486a3fa7e 100644 --- a/packages/types/src/documents/app/app.ts +++ b/packages/types/src/documents/app/app.ts @@ -1,4 +1,4 @@ -import { User, Document, Plugin, Snippet } from "../" +import { User, Document, Plugin, Snippet, Theme } from "../" import { SocketSession } from "../../sdk" export type AppMetadataErrors = { [key: string]: string[] } @@ -14,7 +14,7 @@ export interface App extends Document { instance: AppInstance tenantId: string status: string - theme?: string + theme?: Theme customTheme?: AppCustomTheme revertableVersion?: string lockedBy?: User