Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Update the store to use Core Data entities. #16932

Merged
merged 30 commits into from Aug 22, 2019
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
241a8e1
Editor: Update the store to use Core Data entities.
aduth Jul 25, 2019
3daf3a0
Editor: Fix selector test suites.
epiqueras Aug 6, 2019
90d5e78
Editor: Fix some legacy selectors and behaviors.
epiqueras Aug 7, 2019
4bd2fb1
Editor: Fix action tests.
epiqueras Aug 7, 2019
db8bcab
Editor: Fix remaining broken unit tests.
epiqueras Aug 7, 2019
0190c97
Editor: Fix more tests.
epiqueras Aug 8, 2019
2cdd65d
Editor: Fix more e2e test behaviors.
epiqueras Aug 8, 2019
d2f2320
Editor: Fix preview functionality.
epiqueras Aug 8, 2019
24cb965
Core Data: Fix autosaves filtering.
epiqueras Aug 8, 2019
eec1666
Editor: Don't make entity dirty with initial edits.
epiqueras Aug 9, 2019
b5f9d5f
Editor: Don't save if the post is not saveable.
epiqueras Aug 9, 2019
1d48cd8
Core Data: Fix merged edits logic.
epiqueras Aug 9, 2019
1e91c9b
Core Data: Fix undo to fit e2e expected behaviors.
epiqueras Aug 9, 2019
16e69c8
Core Data: Handle more change detection and saving flows.
epiqueras Aug 9, 2019
d85aada
Block Editor: Fix undo level logic.
epiqueras Aug 9, 2019
8f70fbe
Core Data: Clean up undo reducer comment.
epiqueras Aug 9, 2019
e85a793
Editor: Make `serializeBlocks` a util.
epiqueras Aug 13, 2019
a3a7f55
Core Data: Clarify raw attribute usage.
epiqueras Aug 15, 2019
3ef3016
Core Data: Memoize .
epiqueras Aug 15, 2019
0e76e4c
Core Data: Use new raw entity record selector instead of modifying th…
epiqueras Aug 19, 2019
c271d86
Core Data: Make save notices the caller's responsibility.
epiqueras Aug 19, 2019
6c96372
Editor: Use the store key constant in actions instead of a string lit…
epiqueras Aug 19, 2019
5cde8c8
Editor: Defer serialization of blocks until save.
epiqueras Aug 19, 2019
f884aed
Editor: Fix raw content access in set up.
epiqueras Aug 20, 2019
aeff970
Editor: Revert broken test change.
epiqueras Aug 20, 2019
af24680
Editor: Make initial edits a dirtying operation.
epiqueras Aug 21, 2019
aa81118
Editor: Add comment clarifying why we set content to a new function o…
epiqueras Aug 21, 2019
4630675
Demo: Fix tests to consider the initial edits dirtying.
epiqueras Aug 21, 2019
a020241
Core Data: Set auto-drafts to drafts when autosaving them.
epiqueras Aug 21, 2019
272dfd2
Core Data: Handle receiving autosaves correctly when editing non-auto…
epiqueras Aug 22, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

Core Data: Handle receiving autosaves correctly when editing non-auto…

…save-persisting-properties.
  • Loading branch information...
epiqueras committed Aug 22, 2019
commit 272dfd27588b4574871cb748b01bdd425094a299
@@ -237,6 +237,10 @@ export function* saveEntityRecord(
const path = `${ entity.baseURL }${ recordId ? '/' + recordId : '' }`;

if ( isAutosave ) {
// Most of this autosave logic is very specific to posts.
// This is fine for now as it is the only supported autosave,
// but ideally this should all be handled in the back end,
// so the client just sends and receives objects.
const persistedRecord = yield select(
'getRawEntityRecord',
kind,
@@ -275,13 +279,27 @@ export function* saveEntityRecord(
// when its update is requested by the author and the post had
// draft or auto-draft status.
if ( persistedRecord.id === updatedRecord.id ) {
yield receiveEntityRecords(
kind,
name,
{ ...persistedRecord, ...data, ...updatedRecord },
undefined,
true
);
let newRecord = { ...persistedRecord, ...data, ...updatedRecord };
newRecord = Object.keys( newRecord ).reduce( ( acc, key ) => {
// These properties are persisted in autosaves.
if ( [ 'title', 'excerpt', 'content' ].includes( key ) ) {
// Edits should be the "raw" attribute values.
acc[ key ] = get( newRecord[ key ], 'raw', newRecord[ key ] );
} else if ( key === 'status' ) {
// Status is only persisted in autosaves when going from
// "auto-draft" to "draft".
acc[ key ] =
persistedRecord.status === 'auto-draft' &&
newRecord.status === 'draft' ?
newRecord.status :
persistedRecord.status;
} else {
// These properties are not persisted in autosaves.
acc[ key ] = get( persistedRecord[ key ], 'raw', persistedRecord[ key ] );
}
return acc;
}, {} );
yield receiveEntityRecords( kind, name, newRecord, undefined, true );
} else {
yield receiveAutosaves( persistedRecord.id, updatedRecord );
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.