Add filter to turn off Interactivity API for a block#52579
Merged
westonruter merged 3 commits intotrunkfrom Jul 13, 2023
Merged
Add filter to turn off Interactivity API for a block#52579westonruter merged 3 commits intotrunkfrom
westonruter merged 3 commits intotrunkfrom
Conversation
This was referenced Jul 12, 2023
westonruter
commented
Jul 12, 2023
Comment on lines
+21
to
+22
| * @since 6.3.0 | ||
| * |
Member
Author
There was a problem hiding this comment.
This may not be right.
|
Flaky tests detected in 9858855. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5545553033
|
luisherranz
approved these changes
Jul 12, 2023
…ocks Co-authored-by: Luis Herranz <luisherranz@gmail.com>
This was referenced Jul 13, 2023
luisherranz
approved these changes
Jul 13, 2023
Member
luisherranz
left a comment
There was a problem hiding this comment.
Tested again and it's working perfectly. Feel free to merge 🙂
SantosGuillamot
approved these changes
Jul 13, 2023
Contributor
SantosGuillamot
left a comment
There was a problem hiding this comment.
I've tested as well, and everything seems correct 🙂
spacedmonkey
approved these changes
Jul 13, 2023
westonruter
added a commit
that referenced
this pull request
Jul 13, 2023
…dd/defer-script-loading-strategy * 'trunk' of https://github.com/WordPress/gutenberg: (24 commits) Add filter to turn off Interactivity API for a block (#52579) Search: Remove unnecessary useEffect (#52604) Navigation: Simplify the useSelect for useNavigationMenus (#51977) Item: Unify focus style and add default font styles (#52495) Update Changelog for 16.2.1 Bump plugin version to 16.2.1 Avoid passing undefined `selectedBlockClientId` in `BlockActionsMenu` (#52595) Cover Block: Fix block deprecation when fixed background is enabled (#51612) Nav block: link text color inheritance fixes and tests (#51710) Stabilize defaultBlock, directInsert API's and getDirectInsertBlock selector (#52083) Fix console warning by improving error handling in Nav block classic menu conversion (#52591) Fix: Remove link action of Link UI for draft pages created from Nav block does not correctly remove link. (#52415) Lodash: Remove remaining `_.get()` from block editor and deprecate (#52561) Fix importing classic menus (#52573) ResizableFrame: Make keyboard accessible (#52443) Site Editor: Fix navigation menu sidebar actions order and label (#52592) correct a typo: sapce -> space (#52578) Avoid errors in Dimension visualizers when switching between iframed and non-iframed editors (#52588) Patterns: Add client side pagination to patterns list (#52538) Site Editor: Make sidebar back button go *back* instead of *up* if possible (#52456) ...
86 tasks
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Add a
gutenberg_should_block_use_interactivity_apifilter which allows the experimental Interactivity API to be disabled for a given block.Why?
This is a follow-up to #52553 for reasons explained in #50906 (comment). Currently the only way to prevent the Interactivity API from being used for the File block or Navigation block is to hack the
GUTENBERG_IS_PLUGINconstant to befalse. Since the experimental Interactivity API is not behind an experiment feature flag, this filter is needed in order to be able to access and hack on the old implementations.How?
The
gutenberg_should_block_use_interactivity_apifilter is added in a function of the same name. This is used in places where theGUTENBERG_IS_PLUGINconstant was used to determine whether to use the Interactivity API.Testing Instructions
Add a mu-plugin that that includes this code:
When absent, a post with the File block and Navigation block contain in the footer:
When present, those scripts do not appear in the footer and instead these scripts appear in the
head: