fix: call createDraftFromEntry after entry is loaded instead in Editor (#3418)

* fix: call createDraftFromEntry after entry is loaded instead in Editor
This commit is contained in:
Erez Rokah
2020-03-16 20:48:49 +01:00
committed by GitHub
parent c9b82551ed
commit 2409323dba
6 changed files with 41 additions and 77 deletions

View File

@ -36,12 +36,9 @@ const entryDraftReducer = (state = Map(), action) => {
case DRAFT_CREATE_FROM_ENTRY:
// Existing Entry
return state.withMutations(state => {
state.set('entry', action.payload.entry);
state.set('entry', fromJS(action.payload.entry));
state.setIn(['entry', 'newRecord'], false);
// An existing entry may already have metadata. If we surfed away and back to its
// editor page, the metadata will have been fetched already, so we shouldn't
// clear it as to not break relation lists.
state.set('fieldsMetaData', action.payload.metadata || Map());
state.set('fieldsMetaData', Map());
state.set('fieldsErrors', Map());
state.set('hasChanged', false);
state.set('key', uuid());