-
Notifications
You must be signed in to change notification settings - Fork 4k
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
useOnBlockDrop: Fix TypeError via array coercion #58686
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 Core SVNIf you're a Core Committer, use this list when committing to
GitHub Merge commitsIf 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. |
Size Change: +11 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests well. Would be great if we could add some e2e test coverage for this at some point.
Fixes #58653 Co-authored-by: mcsf <mcsf@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: mrfoxtalbot <mrfoxtalbot@git.wordpress.org>
Cherry picked this PR |
Thanks for fixing this up! |
Fixes #58653
What?
Fix regression by which multiple image files could no longer be inserted in the editor by drag-and-drop action.
How?
At the centre of the bug lies the fact that the Gallery's
files
transform returns a single block instead of an array of blocks. However, this is allowed by the Block API. Theblocks
value crosses several levels of the call stack until it causes the type error, but I decided that theinsertOrReplaceBlocks
callback of theuseOnBlockDrop
hook seems like a sensible catch-all place to coerce theblocks
value.Testing Instructions
See parent issue.