chore: only dev env can throw errors (#2355)
This commit is contained in:
		
							parent
							
								
									23cd6bb4ed
								
							
						
					
					
						commit
						c743d66b8e
					
				| @ -68,8 +68,11 @@ function Label() { | |||||||
|     return null; |     return null; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   if (!systemSettings) { |   if (process.env.NODE_ENV !== 'production' && !currentUser) { | ||||||
|     error('Please check if provide `SystemSettingsProvider` in your app.'); |     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.'); |     throw new Error('Please check if provide `SystemSettingsProvider` in your app.'); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,4 +1,3 @@ | |||||||
| import { isString } from '@nocobase/utils'; |  | ||||||
| import { theme } from 'antd'; | import { theme } from 'antd'; | ||||||
| import _ from 'lodash'; | import _ from 'lodash'; | ||||||
| import { ThemeItem } from '../../types'; | import { ThemeItem } from '../../types'; | ||||||
| @ -9,12 +8,12 @@ import { ThemeItem } from '../../types'; | |||||||
|  */ |  */ | ||||||
| export function changeAlgorithmFromStringToFunction(themeConfig: ThemeItem) { | export function changeAlgorithmFromStringToFunction(themeConfig: ThemeItem) { | ||||||
|   themeConfig = _.cloneDeep(themeConfig); |   themeConfig = _.cloneDeep(themeConfig); | ||||||
|   if (isString(themeConfig.config.algorithm)) { |   if (_.isString(themeConfig.config.algorithm)) { | ||||||
|     themeConfig.config.algorithm = theme[themeConfig.config.algorithm]; |     themeConfig.config.algorithm = theme[themeConfig.config.algorithm]; | ||||||
|   } |   } | ||||||
|   if (Array.isArray(themeConfig.config.algorithm)) { |   if (Array.isArray(themeConfig.config.algorithm)) { | ||||||
|     themeConfig.config.algorithm = themeConfig.config.algorithm.map((item) => { |     themeConfig.config.algorithm = themeConfig.config.algorithm.map((item) => { | ||||||
|       if (isString(item)) { |       if (_.isString(item)) { | ||||||
|         return theme[item]; |         return theme[item]; | ||||||
|       } |       } | ||||||
|       return item; |       return item; | ||||||
|  | |||||||
| @ -1,9 +1,8 @@ | |||||||
| import { Collection } from '@nocobase/database'; |  | ||||||
| import { InstallOptions, Plugin } from '@nocobase/server'; | import { InstallOptions, Plugin } from '@nocobase/server'; | ||||||
| import { antd, compact, compactDark, dark } from './builtinThemes'; | import { antd, compact, compactDark, dark } from './builtinThemes'; | ||||||
| 
 | 
 | ||||||
| export class ThemeEditorPlugin extends Plugin { | export class ThemeEditorPlugin extends Plugin { | ||||||
|   theme: Collection<any, any>; |   theme: any; | ||||||
| 
 | 
 | ||||||
|   afterAdd() {} |   afterAdd() {} | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user