Skip to content

Commit

Permalink
prep build 01/22
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Jan 22, 2024
2 parents f77144b + 7b2350a commit e3be751
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/block-library/src/embed/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,17 @@ const EmbedEdit = ( props ) => {
};

useEffect( () => {
if ( ! preview?.html || ! cannotEmbed || fetching ) {
if ( preview?.html || ! cannotEmbed || fetching ) {
return;
}

// At this stage, we're not fetching the preview and know it can't be embedded,
// so try removing any trailing slash, and resubmit.
const newURL = attributesUrl.replace( /\/$/, '' );
setURL( newURL );
setIsEditingURL( false );
setAttributes( { url: newURL } );
}, [ preview?.html, attributesUrl, cannotEmbed, fetching ] );
}, [ preview?.html, attributesUrl, cannotEmbed, fetching, setAttributes ] );

// Try a different provider in case the embed url is not supported.
useEffect( () => {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/various/embedding.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ test.describe( 'Embedding content', () => {
await expect(
currenEmbedBlock.getByRole( 'textbox', { name: 'Embed URL' } ),
'WordPress invalid content. Should render failed, edit state.'
).toHaveValue( 'https://wordpress.org/gutenberg/handbook/' );
).toHaveValue( 'https://wordpress.org/gutenberg/handbook' );

await embedUtils.insertEmbed( 'https://twitter.com/thatbunty' );
await expect(
Expand Down Expand Up @@ -189,7 +189,7 @@ test.describe( 'Embedding content', () => {
} );

// Reason: A possible regression of https://github.com/WordPress/gutenberg/pull/14705.
test.skip( 'should retry embeds that could not be embedded with trailing slashes, without the trailing slashes', async ( {
test( 'should retry embeds that could not be embedded with trailing slashes, without the trailing slashes', async ( {
editor,
embedUtils,
} ) => {
Expand Down

0 comments on commit e3be751

Please sign in to comment.