diff --git a/packages/plugins/theme-editor/src/client/hooks/useThemeSettings.tsx b/packages/plugins/theme-editor/src/client/hooks/useThemeSettings.tsx index 914d8864b..f4fb2d26e 100644 --- a/packages/plugins/theme-editor/src/client/hooks/useThemeSettings.tsx +++ b/packages/plugins/theme-editor/src/client/hooks/useThemeSettings.tsx @@ -68,8 +68,11 @@ function Label() { return null; } - if (!systemSettings) { - error('Please check if provide `SystemSettingsProvider` in your app.'); + if (process.env.NODE_ENV !== 'production' && !currentUser) { + throw new Error('Please check if provide `CurrentUserProvider` in your app.'); + } + + if (process.env.NODE_ENV !== 'production' && !systemSettings) { throw new Error('Please check if provide `SystemSettingsProvider` in your app.'); } diff --git a/packages/plugins/theme-editor/src/client/utils/changeAlgorithmFromStringToFunction.tsx b/packages/plugins/theme-editor/src/client/utils/changeAlgorithmFromStringToFunction.tsx index c4c2cef1e..f4d04762f 100644 --- a/packages/plugins/theme-editor/src/client/utils/changeAlgorithmFromStringToFunction.tsx +++ b/packages/plugins/theme-editor/src/client/utils/changeAlgorithmFromStringToFunction.tsx @@ -1,4 +1,3 @@ -import { isString } from '@nocobase/utils'; import { theme } from 'antd'; import _ from 'lodash'; import { ThemeItem } from '../../types'; @@ -9,12 +8,12 @@ import { ThemeItem } from '../../types'; */ export function changeAlgorithmFromStringToFunction(themeConfig: ThemeItem) { themeConfig = _.cloneDeep(themeConfig); - if (isString(themeConfig.config.algorithm)) { + if (_.isString(themeConfig.config.algorithm)) { themeConfig.config.algorithm = theme[themeConfig.config.algorithm]; } if (Array.isArray(themeConfig.config.algorithm)) { themeConfig.config.algorithm = themeConfig.config.algorithm.map((item) => { - if (isString(item)) { + if (_.isString(item)) { return theme[item]; } return item; diff --git a/packages/plugins/theme-editor/src/server/plugin.ts b/packages/plugins/theme-editor/src/server/plugin.ts index d5945a3c9..a2d1399e0 100644 --- a/packages/plugins/theme-editor/src/server/plugin.ts +++ b/packages/plugins/theme-editor/src/server/plugin.ts @@ -1,9 +1,8 @@ -import { Collection } from '@nocobase/database'; import { InstallOptions, Plugin } from '@nocobase/server'; import { antd, compact, compactDark, dark } from './builtinThemes'; export class ThemeEditorPlugin extends Plugin { - theme: Collection; + theme: any; afterAdd() {}