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

Editor: Prevent frontend assets from being enqueued in block editor #2312

Closed

Conversation

ocean90
Copy link
Member

@ocean90 ocean90 commented Feb 11, 2022

Related: WordPress/gutenberg#33542

Due to the REST API preloading we may enqueue alot of assets in the editor which are only intended for the frontend. By resetting the globals for scripts/styles we can prevent this.

Trac ticket: https://core.trac.wordpress.org/ticket/55151


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

gziolo
gziolo approved these changes Feb 15, 2022
Copy link
Member

@gziolo gziolo left a comment

Great detective work 😄 It makes a lot of sense to add this logic to prevent accidental pollution of scripts and styles objects.

Separately from that, we should investigate if we really need to render all blocks when preloading them REST API response for the block editor. In the context of post content or template editing we rather use the content stored in the database as is and parse it inside the block editor. I think the processed form is mostly useful when rendering on the front.

@ocean90 ocean90 closed this Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants