Add support for Core Data Entities Actions #7175
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since Fetching Entities including Posts is happening in
core-data
, the logical thing to do is to move updating/removing posts to the thecore-data
module.This is just a POC for the moment and it builds on #6999
The idea is instead of calling the API request in the
editor
module directly when dispatch an async action tocore-data
. This surfaces a lot of things (more questions than answers)A need for async actions to rely on async actions on other modules (or effects to rely on async effects in other modules). In the current PR, this is solved by the fact that async actions return a promise with the returned value from the generators. Whichever solution we end up using, we need something like that: calling side effects from other modules and acting on their result.
Questions about the
currentPost
state and whether it's wise to keep it in theeditor
state or if we should just rely on thepost
object already available incore-data
.Questions about the optimistic updates and whether it's a good fit for the entities because we can't optimistically update the post object, since we'll override the
title.rendered
andcontent.rendered
. These might get used in other modules (other than the editor) and we can't just overwrite them. Maybe we should only send{ title: raw }
to the API if the API supports updates this way but this is not perfect as well because we'd leave arendered
value not in sync with theraw
value, so not certain if we should keep the optimistic updates.