Embed: Fix variation upgrade undo trap#77546
Conversation
| test.fixme( | ||
| 'should restore the paragraph containing the pasted URL when undoing the embed', |
There was a problem hiding this comment.
Based on the discussion in #15102. It's a separate issue, IMO and I will try to resolve it in a follow-up.
There was a problem hiding this comment.
Remove the e2e test case for now. It's better suiteed fo test/e2e/specs/editor/various/copy-cut-paste.spec.js.
|
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. |
|
Size Change: +28 B (0%) Total Size: 7.76 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in ba67196. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24818951713
|
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR!
It seems that the undo functionality does not work correctly when switching hosts from x.com to twitter.com or removing trailing slashes. An unintended useEffect might be executed. Is this something that can be fixed?
Recording.2026-04-23.132659.mp4
Paste YouTube URL with trailing slash: https://www.youtube.com/watch?v=Ad4tM-CDEUc/
Recording.2026-04-23.132817.mp4
|
Right, those attribute adjustments should also be non-persistent. Should be fixed now. |
This comment was marked as outdated.
This comment was marked as outdated.
|
@t-hamano, @ramonjd, I think all issues should be resolved now. I've moved X to Twitter rewrite logic during submissions; it runs every time for those URLs, so it makes sense to handle it early. We can remove it once https://core.trac.wordpress.org/ticket/59142 is resolved. |
ramonjd
left a comment
There was a problem hiding this comment.
This is working as advertised for me, and can confirm it fixes the undo bug. On trunk I'm hitting Ctrl-Z like it's a broken doorbell. Nothing is ringing!
On this branch:
What?
Closes #75198.
A PR that started as a minor refactoring of the Embed block effects, but ended up with bug fixes. Here's the list of changes:
setAttributesinstead ofonReplacewhen the preview resolves to a more-suitable variation. Mark the change non-persistent, so it merges with the URL submit into a single undo level.newURL !== attributesUrlguard.fixmetest pinning the still-broken paste→undo flow;I've also synced these fixes to the
edit.native.jsfile.Why?
onReplaceremounts the block (new clientId). Since we're dealing with block variations, we can use attributes and avoid remount.createUpgradedEmbedBlockshort-circuit for already-matched URLs.newURL !== attributesUrlguard avoids a redundantsetAttributesround-trip.Testing Instructions
Testing Instructions for Keyboard
Same.
Screenshots or screencast
Before
CleanShot.2026-04-22.at.10.32.42.mp4
After
CleanShot.2026-04-22.at.10.31.48.mp4
Use of AI Tools
Claude for rubber ducking 🦆