chore: only dev env can throw errors (#2355)

This commit is contained in:
被雨水过滤的空气-Rain 2023-07-31 13:14:20 +08:00 committed by GitHub
parent 23cd6bb4ed
commit c743d66b8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -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.');
}

View File

@ -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;

View File

@ -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<any, any>;
theme: any;
afterAdd() {}