-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Embed Block: Fix retry processing when embedding with trailing slash fails #58007
Conversation
Size Change: 0 B Total Size: 1.7 MB ℹ️ View Unchanged
|
Flaky tests detected in 9e61fee. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7584549887
|
'WordPress invalid content. Should render failed, edit state.' | ||
).toHaveValue( 'https://wordpress.org/gutenberg/handbook/' ); | ||
).toHaveValue( 'https://wordpress.org/gutenberg/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.
Personally, I think that if the embed fails even if the URL does not have a trailing slash, we should restore it to the original URL.
However, that implementation is not done in #14705 and will require major modifications. If necessary, I think we can respond with follow-up PR.
@Mamaduka Thanks for the review! |
@t-hamano, I think we introduced a regression here. The embed block now retries providers that can be embedded with trailing slash. I discovered while I was debugging flaky embed e2e test - #37503 Update: Started working on the fix in #60655. Testing instructions
Screenshot |
Fixes #58002
What?
This PR fixes an issue where retrying when embedding a URL with a trailing slash fails, implemented in #14705, was not working.
Why?
As far as I can tell, this regression occurred when class components were rewritten to function components in #22845.
https://github.com/WordPress/gutenberg/pull/22846/files?diff=unified&w=1#diff-ef12826bc6a57e80852c9800c4bb8db0157db2b1f1418686fc85088e5438bb78R106-R108
Originally, if a URL with a trailing slash could not be embedded, this block would remove the trailing slash and try to embed it again.
The current conditional statement performs the early return and skips retrying the embed if the preview HTML could NOT be retrieved. I think the expected behavior should be to skip retrying the embed if the preview HTML could be retrieved.
How?
I reversed the conditional statement. Accordingly, I have re-enabled the skipped tests.
Testing Instructions
https://twitter.com/WordPress/
in the URL.https://twitter.com/WordPress
).https://x.com/WordPress/
). It will be translated to thetwitter.com
domain, which is the expected behavior in the current implementation.