mirror of
https://github.com/strapi/strapi.git
synced 2025-12-29 08:04:51 +00:00
fix: reload ctb after save
This commit is contained in:
parent
676c9d44c8
commit
2896c5580a
@ -41,7 +41,7 @@ export interface DataManagerContextValue {
|
||||
removeComponentFromDynamicZone: (dzName: string, componentToRemoveIndex: number) => void;
|
||||
setModifiedData: () => void;
|
||||
sortedContentTypesList: any[]; // Define the actual type
|
||||
submitData: (additionalContentTypeData?: Record<string, any>) => void;
|
||||
submitData: (additionalContentTypeData?: Record<string, any>) => Promise<void>;
|
||||
updateSchema: (data: Record<string, any>, schemaType: SchemaType, componentUID: UID.Any) => void;
|
||||
components: Record<UID.Component, Component>;
|
||||
componentsGroupedByCategory: Record<string, Component[]>;
|
||||
|
||||
@ -6,7 +6,7 @@ import has from 'lodash/has';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import upperFirst from 'lodash/upperFirst';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { Prompt, useRouteMatch } from 'react-router-dom';
|
||||
import { Prompt, useRouteMatch, useHistory } from 'react-router-dom';
|
||||
|
||||
import { List } from '../../components/List';
|
||||
import { ListRow } from '../../components/ListRow';
|
||||
@ -20,6 +20,7 @@ import { LinkToCMSettingsView } from './LinkToCMSettingsView';
|
||||
/* eslint-disable indent */
|
||||
|
||||
const ListView = () => {
|
||||
const history = useHistory();
|
||||
const { initialData, modifiedData, isInDevelopmentMode, isInContentTypeView, submitData } =
|
||||
useDataManager();
|
||||
const { formatMessage } = useIntl();
|
||||
@ -49,6 +50,10 @@ const ListView = () => {
|
||||
|
||||
const forTarget = isInContentTypeView ? 'contentType' : 'component';
|
||||
|
||||
const handleReload = () => {
|
||||
history.go(0); // Reloads the current page
|
||||
};
|
||||
|
||||
const handleClickAddComponentToDZ = (dynamicZoneTarget?: string) => {
|
||||
onOpenModalAddComponentsToDZ({ dynamicZoneTarget, targetUid });
|
||||
};
|
||||
@ -142,7 +147,10 @@ const ListView = () => {
|
||||
)}
|
||||
<Button
|
||||
startIcon={<Check />}
|
||||
onClick={() => submitData()}
|
||||
onClick={async () => {
|
||||
await submitData();
|
||||
handleReload();
|
||||
}}
|
||||
type="submit"
|
||||
disabled={isEqual(modifiedData, initialData)}
|
||||
>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user