Skip to content

Commit 9abf6eb

Browse files
committed
Made base-shell more robust for missing configs
1 parent 077044b commit 9abf6eb

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

packages/base-shell/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/base-shell/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "base-shell",
3-
"version": "2.3.5",
3+
"version": "2.3.6",
44
"description": "base-shell React component",
55
"main": "lib/index.js",
66
"module": "es/index.js",

packages/base-shell/src/containers/Layout/Layout.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,23 @@ export const LayoutContent = ({ appConfig = {} }) => {
2424
} = appConfig || {}
2525
const { persistKey } = auth || {}
2626
const { checkInterval = 5000 } = update || {}
27-
const { Menu, Loading } = components || {}
27+
const { Menu, Loading = () => <div>Loading...</div> } = components || {}
2828
const { locales, onError } = confLocale || {}
2929
const { LayoutContainer = React.Fragment } = containers || {}
3030
const defaultRoutes = getDefaultRoutes ? getDefaultRoutes(appConfig) : []
31-
const { locale } = useLocale()
31+
const { locale = {} } = useLocale()
3232

3333
useEffect(() => {
3434
const loadPolyfills = async () => {
3535
//loadLocalePolyfill(locale)
3636

37-
for (let i = 0; i < locales.length; i++) {
38-
const l = locales[i]
39-
if (l.locale === locale) {
40-
if (l.loadData) {
41-
await l.loadData
37+
if (locale.locales && locale.locales.length > 0) {
38+
for (let i = 0; i < locales.length; i++) {
39+
const l = locales[i]
40+
if (l.locale === locale) {
41+
if (l.loadData) {
42+
await l.loadData
43+
}
4244
}
4345
}
4446
}

0 commit comments

Comments
 (0)