Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editor: Prevent front-end assets of a block from being enqueued in th…
…e block editor. Since WordPress 5.9 you can set a view script for a block which is supposed to be only loaded on the front end. Unfortunately it's currently also loaded in the editor which can cause unexpected behaviour and also performance issues depending on the size of the scripts. This is caused by the preloading of REST API routes via `block_editor_rest_api_preload()` which doesn't happen in an encapsulated process and so does pollute any global state like the one for scripts and styles. Similar to the global `$post`, core now backups the globals `$wp_scripts` and `$wp_styles` and restores the backup after the preloading. Props gziolo, ocean90. Merges [52733] to the 5.9 branch. Fixes #55151. git-svn-id: https://develop.svn.wordpress.org/branches/5.9@52745 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information