-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Media library modal: Fix plugin incompatibilities with MediaUpload filter #70648
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
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @sunnykasera3107. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
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.
Makes sense ✅
Size Change: -74 B (0%) Total Size: 1.89 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.
Thanks for digging into this one! Yes, I think a partial revert for now sounds like a good way to handle it 👍
(As an aside, fascinating that the original component was being extended by plugins... I'd always assumed folks would replace rather than extend)
Thanks for the quick fix 🙇🏻 |
Unfortunately it looks like there are some CI errors with the PHP unit tests:
Kinda random. |
I'm seeing those a lot lately. Our Docker env is becoming unstable 😢 |
Yeah, it's curious it happens in CI, but not in my local env so much. I've tried re-running the tests a few times now, but I'll try some more 😄 |
I don't think we'll be getting this to pass by re-running the tests. This is the previous discussion around this error - wp-env Error while running docker compose command. Having said that, it's quite a generic error, so it might not always be the same issue. |
Slightly different error on the latest try -
When testing locally I don't get this at all, so it's very unusual. Other CI tests also not experiencing the same issue. |
…mponent to prevent upstream errors in plugins
5e70d44
to
31b1b6f
Compare
The same checks also started failing on my old PR. It could be an upstream issue. |
Might be a debian package server issue... seems to be up. 🤔 I tried cleaning out the local repository of retrieved package files using I really don't know why though 😄 |
When I asked copilot to explain the error it also said to do that. 😄 It seems like it clears the local cache of downloaded packages. I think we should do it, and then we can also remove that line later if the error seems to go away. I also wonder if clearing the caches here will help - https://github.com/WordPress/gutenberg/actions/caches |
I just tried deleting the cache for this PR, now re-running again. |
'Approaching' the limit, like approaching an event horizon. |
Still failed after deleting the github actions cache.
I've pushed this change 🤞 |
Still failed. I think this PR is cursed as Ramon's version #70652 seems to be passing. |
🤞🏻 they're passing now. Maybe it's just flakey. |
I cleared the actions caches again, maybe that did the trick. Just a waiting game now. |
…lter (#70648) * Media library modal: Ensure modal is passed into filter as a class component to prevent upstream errors in plugins * Revert media upload invalidation change * Clean packages before running apt-get update - kudos @ramonjd ---- Unlinked contributors: sunnykasera3107. Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Thanks for your help getting this across the line folks! |
@talldan thanks for bringing this to my attention. Agreed that I actually just saw #70405 yesterday by chance and was wondering why it was solved this way. #70397 mentions stale data when dragging images into the canvas and then opening the media inserter. This has nothing to do with the The |
It was another case that I noticed while working on the problem, it is mentioned in the testing steps in the PR.
Yeah, it's admittedly subpar. Maybe there are other integration points for cache invalidation, but I didn't spot any obvious ones.
I think you can also invalidate There's another issue I've noticed since working on #70405. Some code might interact with media items via a call like In the long run I think it might be an option to try relocating some of the code from the |
…lter (#70648) * Media library modal: Ensure modal is passed into filter as a class component to prevent upstream errors in plugins * Revert media upload invalidation change * Clean packages before running apt-get update - kudos @ramonjd ---- Unlinked contributors: sunnykasera3107. Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
What?
Fixes #70647
Some users started experiencing errors after Gutenberg 21.1. Example here - https://wordpress.org/support/topic/unexpected-error-after-updating-to-21-1-0/.
From my testing, this seems to be caused by an incompatibility between gutenberg and the AMP plugin (cc @westonruter, @swissspidy). There may also be other plugins that have similar issues.
After #70405 the
MediaUpload
filter instead started receiving a function component instead of a class component.I think this is the relevant code in AMP - https://github.com/ampproject/amp-wp/blob/7b4ed4c001cdc0fbf9adb518fb0b8e1ddebf4d5a/assets/src/block-editor/components/with-media-library-notice.js.
Notice that it calls
extend
on theInitialMediaUpload
arg from the filter, so when a function component started being used this failed. This code seems like it has the potential to cause lots of general incompatibilities, for example if other plugins use the filter and modify the return results.To temporarily fix this I'm proposing to partially revert #70405 and release a hotfix with that change.
Testing Instructions