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