Skip to content

Commit

Permalink
Core Data: Merge in new edits when restoring state after a failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
epiqueras committed Sep 24, 2019
1 parent 91a4ddf commit 7476ed3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/core-data/src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,16 @@ export function* saveEntityRecord(
// we need to roll it back here.
if ( persistedEntity && currentEdits ) {
yield receiveEntityRecords( kind, name, persistedEntity, undefined, true );
yield editEntityRecord( kind, name, recordId, currentEdits, { undoIgnore: true } );
yield editEntityRecord(
kind,
name,
recordId,
{
...currentEdits,
...( yield select( 'getEntityRecordEdits', kind, name, recordId ) ),
},
{ undoIgnore: true }
);
}
}
yield {
Expand Down

0 comments on commit 7476ed3

Please sign in to comment.