Skip to content

Commit

Permalink
Remove extraction of raw values in saveEntityRecords – wrapped values…
Browse files Browse the repository at this point in the history
… are accepted by the API and store without any issues (WordPress#34502)
  • Loading branch information
adamziel authored Sep 3, 2021
1 parent 0d6a201 commit c1b800a
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions packages/core-data/src/actions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { castArray, get, isEqual, find } from 'lodash';
import { castArray, isEqual, find } from 'lodash';
import { v4 as uuid } from 'uuid';

/**
Expand Down Expand Up @@ -425,8 +425,7 @@ export const saveEntityRecord = (
if (
[ 'title', 'excerpt', 'content' ].includes( key )
) {
// Edits should be the "raw" attribute values.
acc[ key ] = get( data[ key ], 'raw', data[ key ] );
acc[ key ] = data[ key ];
}
return acc;
},
Expand Down Expand Up @@ -461,12 +460,7 @@ export const saveEntityRecord = (
key
)
) {
// Edits should be the "raw" attribute values.
acc[ key ] = get(
newRecord[ key ],
'raw',
newRecord[ key ]
);
acc[ key ] = newRecord[ key ];
} else if ( key === 'status' ) {
// Status is only persisted in autosaves when going from
// "auto-draft" to "draft".
Expand All @@ -477,11 +471,7 @@ export const saveEntityRecord = (
: persistedRecord.status;
} else {
// These properties are not persisted in autosaves.
acc[ key ] = get(
persistedRecord[ key ],
'raw',
persistedRecord[ key ]
);
acc[ key ] = persistedRecord[ key ];
}
return acc;
},
Expand Down

0 comments on commit c1b800a

Please sign in to comment.