mirror of
https://github.com/strapi/strapi.git
synced 2025-12-03 02:23:44 +00:00
Fix content-manager CANCEL_CHANGES action bug
This commit is contained in:
parent
b156a9fc73
commit
fe56274217
@ -177,7 +177,7 @@ export class Edit extends React.Component {
|
||||
const mainField = get(this.props.models, `${this.props.currentModelName}.info.mainField`) || primaryKey;
|
||||
const pluginHeaderTitle = this.props.isCreating ? 'New entry' : templateObject({ mainField }, this.props.record.toJS()).mainField;
|
||||
const pluginHeaderDescription = this.props.isCreating ? 'New entry' : `#${this.props.record && this.props.record.get(primaryKey)}`;
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={`container-fluid ${styles.containerFluid}`}>
|
||||
|
||||
@ -31,6 +31,7 @@ const initialState = fromJS({
|
||||
currentModelName: '',
|
||||
loading: false,
|
||||
record: false,
|
||||
initialRecord: {},
|
||||
editing: false,
|
||||
deleting: false,
|
||||
isCreating: false,
|
||||
@ -61,7 +62,8 @@ function editReducer(state = initialState, action) {
|
||||
case LOAD_RECORD_SUCCESS:
|
||||
return state
|
||||
.set('loading', false)
|
||||
.set('record', fromJS(action.record));
|
||||
.set('record', fromJS(action.record))
|
||||
.set('initialRecord', fromJS(action.record));
|
||||
case SET_RECORD_ATTRIBUTE:
|
||||
return state
|
||||
.setIn(['record', action.key], fromJS(action.value));
|
||||
@ -82,7 +84,7 @@ function editReducer(state = initialState, action) {
|
||||
case TOGGLE_NULL:
|
||||
return state.set('isRelationComponentNull', !state.get('isRelationComponentNull'));
|
||||
case CANCEL_CHANGES:
|
||||
return state.set('record', Map({}));
|
||||
return state.set('record', state.get('initialRecord'));
|
||||
case SET_FORM_VALIDATIONS:
|
||||
return state
|
||||
.set('formValidations', List(action.formValidations));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user