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
Cover block: fix exception when adding video background #53961
Conversation
@ajlende we have been passing video to |
Size Change: +28 B (0%) Total Size: 1.51 MB
ℹ️ View Unchanged
|
Flaky tests detected in 8efe2ea. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5993718106
|
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.
Appreciate the quick fix @glendaviesnz 👍
✅ Could replicate the initial issue
✅ After checking out this PR, I can successfully add a video, with no errors
Screen.Recording.2023-08-26.at.4.20.25.pm.mp4
Given that video was just failing by default previously I think this is a reasonable fix. We can follow up if we decide we do want to support video somehow. |
What?
Fixes exception that is thrown if video is added as cover background.
Why?
Adding a video causes fastAverageColor to throw an exception. This was an existing problem but was previously masked by the fact that the exception was thrown in an effect, but now that the check is done in an event handle it disrupts the attribute update process.
Fixes: #53956
How?
Wraps the call to fastAverageColor in a try/catch and also only passes images to this call, not video.
Testing Instructions
Screenshots or screencast
Before:
cover-bug-before.mp4
After:
cover-bug-after.mp4