Fix: Error when calling the PostActions view-post callback#63460
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @sejas! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
|
@jorgefilipecosta , could you take a look if this is the right direction for this fix? Thank you! |
Mamaduka
left a comment
There was a problem hiding this comment.
I can reproduce the error, and the fix makes sense.
I'm not super familiar with post actions, so will leave final approval to @jorgefilipecosta.
|
This makes sense to me 👍 |
jorgefilipecosta
left a comment
There was a problem hiding this comment.
Tha change look good, thank you for this fix 👍
Co-authored-by: sejas <antoniosejas@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
|
I just cherry-picked this PR to the release/18.8 branch to get it included in the next release: e0afea2 |
Co-authored-by: sejas <antoniosejas@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
What?
Fixes the error thrown when clicking PostActions View post in the editor.
Why?
In #63120 we added support for
onActionPerformedat action level, but I've observed the object is undefined in all the cases.I could check.
onActionPerformedis only used at hook level instead. If we need to remove the logic that unpacksargsObject, I'm happy to update this PR or open a new one.How?
Add a condition in case the callback options
argsObjectis undefined.Testing Instructions
/wp-admin/post.php?post=1&action=edit.Testing Instructions for Keyboard
Screenshots or screencast
Before
post-action-view-before.mp4
After
post-action-view-after.mp4