Skip to content
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

Remove legacy logic for __unstableResolvedAssets #51100

Merged
merged 2 commits into from
May 31, 2023

Conversation

oandregal
Copy link
Member

What?

This removes the _gutenberg_resolve_assets_override function that lives at lib/compat/wordpress-6.2/script-loader.php.

Why?

The purpose of that function is to prepare the data for the __unstableResolvedAssets setting. However, we already do that in the _gutenberg_get_iframed_editor_assets function that lives at lib/compat/wordpress-6.2/script-loader.php, so it loads later. We don't want to run the same logic twice.

How?

Remove the older code.

Testing Instructions

Verify that iframe tests pass.

@oandregal oandregal self-assigned this May 30, 2023
@oandregal oandregal requested a review from ellatrix May 30, 2023 15:15
@oandregal oandregal changed the title Remove legacy logic for resolving assets for iframe Remove legacy logic for __unstableResolvedAssets May 30, 2023
Because _gutenberg_get_iframed_editor_assets is the only callback for setting
__unstableResolvedAssets we no longer need to increase the priority.
@@ -80,6 +80,5 @@ function( $settings ) {
// We must override what core is passing now.
$settings['__unstableResolvedAssets'] = _gutenberg_get_iframed_editor_assets();
return $settings;
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because gutenberg_resolve_assets_override is removed, _gutenberg_get_iframed_editor_assets no longer needs to increase the priority for it to run later. It will be now the only callback for setting __unstableResolvedAssets. I see it was introduced https://github.com/WordPress/gutenberg/pull/49655/files#diff-d66c57d67603bf45e2664289929b228b0eb69b037553b5c35a3497182a7e17d5R84

$style_handles[] = 'wp-block-library-theme';
}

if ( 'widgets.php' === $pagenow || 'customize.php' === $pagenow ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ellatrix Is there any part of this that we should have at _gutenberg_get_iframed_editor_assets? This bit for the widgets screen caught my eye.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check that in #50091, but as far as I could tell, these editors were not iframed.

@github-actions
Copy link

Flaky tests detected in 78af900.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5123318458
📝 Reported issues:

@ellatrix ellatrix merged commit c3ce573 into trunk May 31, 2023
@ellatrix ellatrix deleted the remove/duplicated-assets-for-iframe branch May 31, 2023 06:00
@github-actions github-actions bot added this to the Gutenberg 16.0 milestone May 31, 2023
@ndiego ndiego added the [Type] Code Quality Issues or PRs that relate to code quality label Jun 7, 2023
sethrubenstein pushed a commit to pewresearch/gutenberg that referenced this pull request Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants