-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Extra action triggered when saving posts #17485
Comments
This is because we had to make the action return the updated record in #17030, because that was the previous behavior and plugins relied on it. |
To clarify, the behaviour where the action is returning the updated record is considered a bug? If so, there's some discussion in this pull about this and it'd be good if any #dev-note includes the best practice way to handle the scenario described in that pull. |
What's considered a bug is the fact that that record is considered as a redux action and is dispatched automatically if it contains a "type" key which is the case for post entities. The fix could be to "just" avoid considering the returned objects as actions but If I understood properly, we might not be able to do it without breaking changes? |
Both are breaking changes.
I am leaning more towards A here, even if that requires more refactoring work on our part. If we go with B, getting the post would involve subscribing to the store to figure out when the action resolved and the post was updated. This makes it a pain to use in promise driven workflows and people will just resort to using the API directly. Also, it might be just me, but the fact that you can either yield or return an action doesn't sit right with me, and it's making our JSDOCs inconsistent, so we would also kill that bird with this stone. |
Previously: #14711 (comment), #14830 It never really sat well with me that we would resolve If we go the route that we stop treating the I agree with @epiqueras that it's odd we support action dispatching from generators by both |
I'd say |
This seems fixed. |
There's a redux action that is triggered on the "core" store at the end of the "post saving" but this is not really an action (it's the actual post object) and shouldn't be triggered. (see the "post'" action in the screenshot)
cc @epiqueras
The text was updated successfully, but these errors were encountered: