React 管理员:无法读取未定义的 属性 'filter'
React admin: Cannot read property 'filter' of undefined
我正在使用 react admin together with API Platform admin,我无法弄清楚为什么我在生产环境中遇到此错误,但在本地 docker 环境中却没有:
react-dom.production.min.js:3282
TypeError: Cannot read property 'filter' of undefined
at l (fieldFactory.js:21)
at p (List.js:83)
at beginWork (react-dom.production.min.js:2902)
at o (react-dom.production.min.js:4051)
at a (react-dom.production.min.js:4068)
at x (react-dom.production.min.js:4296)
at w (react-dom.production.min.js:4263)
at b (react-dom.production.min.js:4254)
at interactiveUpdates (react-dom.production.min.js:4563)
at xn (react-dom.production.min.js:1684)
我正在使用 demo example,但不知道是哪个元素导致了这个问题:有没有办法知道是哪个元素导致了错误?
结果是我错误地提供了如图所示的自定义路由 in the demo and then using API platform's authentication example 来设置这些自定义路由:
switch (result.status) {
case 401:
return Promise.resolve({
api: result.api,
customRoutes: [{
props: {
path: '/',
render: () => <Redirect to={`/login`}/>,
},
}],
});
default:
return Promise.reject(result);
}
...
<HydraAdmin
title=""
dataProvider={dataProvider}
customReducers={{ theme: themeReducer }}
customSagas={sagas}
customRoutes={customRoutes}
authProvider={authProvider}
dashboard={Dashboard}
loginPage={Login}
appLayout={Layout}
menu={Menu}
locale="en"
i18nProvider={i18nProvider}
>
...
提供到 API 平台的错误路由触发了该错误。所以我通过删除自定义路由来修复它:customRoutes={customRoutes}
我正在使用 react admin together with API Platform admin,我无法弄清楚为什么我在生产环境中遇到此错误,但在本地 docker 环境中却没有:
react-dom.production.min.js:3282
TypeError: Cannot read property 'filter' of undefined
at l (fieldFactory.js:21)
at p (List.js:83)
at beginWork (react-dom.production.min.js:2902)
at o (react-dom.production.min.js:4051)
at a (react-dom.production.min.js:4068)
at x (react-dom.production.min.js:4296)
at w (react-dom.production.min.js:4263)
at b (react-dom.production.min.js:4254)
at interactiveUpdates (react-dom.production.min.js:4563)
at xn (react-dom.production.min.js:1684)
我正在使用 demo example,但不知道是哪个元素导致了这个问题:有没有办法知道是哪个元素导致了错误?
结果是我错误地提供了如图所示的自定义路由 in the demo and then using API platform's authentication example 来设置这些自定义路由:
switch (result.status) {
case 401:
return Promise.resolve({
api: result.api,
customRoutes: [{
props: {
path: '/',
render: () => <Redirect to={`/login`}/>,
},
}],
});
default:
return Promise.reject(result);
}
...
<HydraAdmin
title=""
dataProvider={dataProvider}
customReducers={{ theme: themeReducer }}
customSagas={sagas}
customRoutes={customRoutes}
authProvider={authProvider}
dashboard={Dashboard}
loginPage={Login}
appLayout={Layout}
menu={Menu}
locale="en"
i18nProvider={i18nProvider}
>
...
提供到 API 平台的错误路由触发了该错误。所以我通过删除自定义路由来修复它:customRoutes={customRoutes}