mirror of
https://github.com/strapi/strapi.git
synced 2025-12-04 02:51:26 +00:00
Fix content-manager CANCEL_CHANGES action bug
This commit is contained in:
parent
b156a9fc73
commit
fe56274217
@ -31,6 +31,7 @@ const initialState = fromJS({
|
|||||||
currentModelName: '',
|
currentModelName: '',
|
||||||
loading: false,
|
loading: false,
|
||||||
record: false,
|
record: false,
|
||||||
|
initialRecord: {},
|
||||||
editing: false,
|
editing: false,
|
||||||
deleting: false,
|
deleting: false,
|
||||||
isCreating: false,
|
isCreating: false,
|
||||||
@ -61,7 +62,8 @@ function editReducer(state = initialState, action) {
|
|||||||
case LOAD_RECORD_SUCCESS:
|
case LOAD_RECORD_SUCCESS:
|
||||||
return state
|
return state
|
||||||
.set('loading', false)
|
.set('loading', false)
|
||||||
.set('record', fromJS(action.record));
|
.set('record', fromJS(action.record))
|
||||||
|
.set('initialRecord', fromJS(action.record));
|
||||||
case SET_RECORD_ATTRIBUTE:
|
case SET_RECORD_ATTRIBUTE:
|
||||||
return state
|
return state
|
||||||
.setIn(['record', action.key], fromJS(action.value));
|
.setIn(['record', action.key], fromJS(action.value));
|
||||||
@ -82,7 +84,7 @@ function editReducer(state = initialState, action) {
|
|||||||
case TOGGLE_NULL:
|
case TOGGLE_NULL:
|
||||||
return state.set('isRelationComponentNull', !state.get('isRelationComponentNull'));
|
return state.set('isRelationComponentNull', !state.get('isRelationComponentNull'));
|
||||||
case CANCEL_CHANGES:
|
case CANCEL_CHANGES:
|
||||||
return state.set('record', Map({}));
|
return state.set('record', state.get('initialRecord'));
|
||||||
case SET_FORM_VALIDATIONS:
|
case SET_FORM_VALIDATIONS:
|
||||||
return state
|
return state
|
||||||
.set('formValidations', List(action.formValidations));
|
.set('formValidations', List(action.formValidations));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user