Init empty states

Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
soupette 2021-10-05 12:28:41 +02:00
parent 8160b84881
commit 6abe749058
4 changed files with 13 additions and 5 deletions

View File

@ -16,7 +16,6 @@
"@strapi/plugin-documentation": "3.6.8",
"@strapi/plugin-graphql": "3.6.8",
"@strapi/plugin-i18n": "3.6.8",
"@strapi/plugin-users-permissions": "3.6.8",
"@strapi/provider-email-mailgun": "3.6.8",
"@strapi/provider-upload-aws-s3": "3.6.8",
"@strapi/provider-upload-cloudinary": "3.6.8",

View File

@ -126,8 +126,6 @@ function ListView({
return;
}
console.log('iii');
console.error(err);
toggleNotification({
type: 'warning',
@ -355,6 +353,9 @@ export function mapDispatchToProps(dispatch) {
dispatch
);
}
const withConnect = connect(mapStateToProps, mapDispatchToProps);
const withConnect = connect(
mapStateToProps,
mapDispatchToProps
);
export default compose(withConnect)(memo(ListView, isEqual));

View File

@ -400,6 +400,10 @@ const DataManagerProvider = ({
const shouldRedirect = useMemo(() => {
const dataSet = isInContentTypeView ? contentTypes : components;
if (currentUid === 'create-content-type') {
return false;
}
return !Object.keys(dataSet).includes(currentUid) && !isLoading;
}, [components, contentTypes, currentUid, isInContentTypeView, isLoading]);
@ -408,7 +412,7 @@ const DataManagerProvider = ({
.filter(uid => get(contentTypes, [uid, 'schema', 'visible'], true))
.sort();
return get(allowedEndpoints, '0', '');
return get(allowedEndpoints, '0', 'create-content-type');
}, [contentTypes]);
if (shouldRedirect) {

View File

@ -26,6 +26,10 @@ const App = () => {
<Layout sideNav={<ContentTypeBuilderNav />}>
<Suspense fallback={<LoadingIndicatorPage />}>
<Switch>
<Route
path={`/plugins/${pluginId}/content-types/create-content-type`}
component={ListView}
/>
<Route path={`/plugins/${pluginId}/content-types/:uid`} component={ListView} />
<Route
path={`/plugins/${pluginId}/component-categories/:categoryUid`}