mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +00:00
Fix redirection
This commit is contained in:
parent
4b50faf331
commit
771b8ab9b5
@ -148,13 +148,19 @@ function EditView({
|
||||
}
|
||||
};
|
||||
|
||||
fetchGroupLayouts();
|
||||
|
||||
if (!isCreatingEntry) {
|
||||
fetchData();
|
||||
} else {
|
||||
dispatch({
|
||||
type: 'INIT',
|
||||
data: setDefaultForm(get(layout, ['schema', 'attributes'])),
|
||||
});
|
||||
}
|
||||
|
||||
fetchGroupLayouts();
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [id, isCreatingEntry, slug, source]);
|
||||
}, [id, isCreatingEntry, slug, source, pathname]);
|
||||
|
||||
if (shouldShowLoader) {
|
||||
return <LoadingIndicatorPage />;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import { fromJS } from 'immutable';
|
||||
import { get } from 'lodash';
|
||||
|
||||
const setDefaultForm = attributes => {
|
||||
@ -34,17 +33,7 @@ const setDefaultForm = attributes => {
|
||||
}, {});
|
||||
};
|
||||
|
||||
function init(initialState, layout, isCreatingEntry) {
|
||||
if (isCreatingEntry) {
|
||||
const defaultForm = setDefaultForm(
|
||||
get(layout, ['schema', 'attributes'], {})
|
||||
);
|
||||
|
||||
return initialState
|
||||
.update('initialData', () => fromJS(defaultForm))
|
||||
.update('modifiedData', () => fromJS(defaultForm));
|
||||
}
|
||||
|
||||
function init(initialState) {
|
||||
return initialState;
|
||||
}
|
||||
|
||||
|
||||
@ -85,6 +85,10 @@ function reducer(state, action) {
|
||||
return obj;
|
||||
})
|
||||
.update('isLoadingForLayouts', () => false);
|
||||
case 'INIT':
|
||||
return initialState
|
||||
.set('initialData', fromJS(action.data))
|
||||
.set('modifiedData', fromJS(action.data));
|
||||
case 'MOVE_FIELD':
|
||||
return state.updateIn(['modifiedData', ...action.keys], list => {
|
||||
return list
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user