Repository navigation
Interactivity API: Iteration for WP 6.6 #60219
Copy link
Copy link
Closed
Labels
[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Feature] Interactivity APIAPI to add frontend interactivity to blocks.API to add frontend interactivity to blocks.[Type] IterationScoped iteration of an effort from a tracking issue or overview issue ideally for a major release.Scoped iteration of an effort from a tracking issue or overview issue ideally for a major release.
Description
- Part of Block API #41236.
We completed everything for the first public release of the Interactivity API in WordPress 6.5. Now, during the next iteration―which is going to be shorter―, we aim to focus on improving the current API without releasing new features. This includes enhancing the developer experience (especially during debugging), better test coverage and code quality, as well as fixing any reported bugs.
Note that the list is expected to be modified. I've also added optional tasks we can work on if we find the time.
28-05 Update: All tasks have been redistributed for 6.6 release summary.
Punted to future releases
- Interactivity Router: Support Handling
navigate()Failure States #59856 - Interactivity API: Allow async directive registration #60670
- Interactivity API: Defer hydration until node is scrolled near the viewport #58284
Won't do
- Interactivity API: Debug - Show directive names included in each Directives component on Preact’s debug tools #60049
- Interactivity API: Added comments for directive parsing #61456
Ready for 6.6
Enhancements
- Interactivity API: Include
preact/debugwhenSCRIPT_DEBUGis enabled #60514 - Introduce
wp-on-asyncdirective as performant alternative over synchronouswp-ondirective #61885 - Update the query block to permit non-core interactive blocks #60006
- Add Interactivity API hooks to wp_admin wordpress-develop#6453
- KSES: Allow leading trailing double hyphen in data attributes wordpress-develop#6598
- Interactivity API: Add debug notices for SSR wordpress-develop#6413
- Interactivity API: Add server derived state getter handling wordpress-develop#6394
Bug fixes
- Interactivity: Return useMemo and useCallback hooks #60474
- Interactivity API: Allow multiple event handlers for the same type with
data-wp-on. #60661 - Interactivity API: Allow multiple event handlers for the same type with
data-wp-on-documentanddata-wp-on-window. #61009 - Interactivity API: Prevent wrong written directives from killing the runtime #61249
- Interactivity API: Prevent empty namespace or different namespaces from killing the runtime #61409
- Interactivity API bug: Fix fatal error when trying to use a stdClass as state-context. wordpress-develop#6672
- Interactivity API: Increase directive
wp-each-childpriority. #62293
Code Quality
- Interactivity API: Turn named capturing groups back into numbered ones inside
toVdom#61728 - Interactivity API: Move all utils inside
utils.ts#61721 - Interactivity API refactor to TypeScript (utils & kebabToCamelCase) #60149
- Interactivity: Strict type checking #59865
- Interactivity API: Add types for warn helper. #61687
- Interactivity API : Refactor interactivity-router to TS #61730
- Editor: Move Interactivity directives processing to WP_Block class wordpress-develop#6331
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Feature] Interactivity APIAPI to add frontend interactivity to blocks.API to add frontend interactivity to blocks.[Type] IterationScoped iteration of an effort from a tracking issue or overview issue ideally for a major release.Scoped iteration of an effort from a tracking issue or overview issue ideally for a major release.
Type
Projects
- StatusShow more project fields✅ Done
Activity
[-]Epic: Interactivity API - Iteration for WP 6.6[/-][+]Interactivity API - Iteration for WP 6.6[/+]felixarntz commentedon Apr 2, 2024
@DAreRodz @gziolo What's the best path to consider additional workstreams for the Interactivity API for 6.6?
Context is that @westonruter and myself have been exploring ideas to facilitate better INP performance centrally via the Interactivity API. For instance, we could automatically yield certain actions and callbacks to the main thread to reduce contention between multiple event listeners. We're close to formalizing our proposal in an issue, and it would be great to eventually include this effort here, if the team is on board.
One of the changes we're proposing may require a BC break in the API which we could handle with a deprecation strategy, but it would also benefit from being implemented sooner than later, now that the API is still very new and not yet as widely adopted outside of core.
DAreRodz commentedon Apr 3, 2024
Hey @felixarntz, thanks for raising this up! 😊
I'm unsure what would be the "best path" (maybe @gziolo could help), but as this tracking issue is meant to be flexible, I would be happy to include your work. Let's wait for the proposal to see if we can have it ready for WP 6.6 and how the mentioned breaking changes could impact the current API.
gziolo commentedon Apr 3, 2024
That sounds excellent, @felixarntz. I'm looking forward to seeing the proposal.
@DAreRodz, the
Iterationissues mostly bring focus and increase the visibility of what to expect in WordPress 6.6, but it doesn't mean we can't change it. In practice, we should always be open to changing the plans based on the feedback and discoveries from the community experts 😍sirreal commentedon Apr 4, 2024
The ability to use existing WordPress Scripts from Script Modules is one of the most impactful things we can work on for the Interactivity API. Anything built with the Interactivity API must be a script module, so although it's not strictly Interactivity API, resolving this ticket for script and module interoperability seems very important: https://core.trac.wordpress.org/ticket/60647
sethrubenstein commentedon Apr 4, 2024
Second @sirreal calls for WordPress scripts. We use
wp-api-fetchandwp-urlwith interactive blocks, a lot. Making that easier from a dev tooling perspective to automatically enqueue those scripts would be greatly appreciated.ermincelikovic commentedon Apr 5, 2024
Is there any chance to get interactivity api outside of blocks? For example in custom php templates?
felixarntz commentedon Apr 5, 2024
@ermincelikovic While I believe it's not documented, it should already be possible. The main caveat is that by default custom PHP templates wouldn't be processed server-side, so you have to make sure the attributes that are dynamic via the Interactivity API are initialized with their correct value.
As a proof of concept, I have been working on WordPress/wordpress-develop#5795 where I am using the Interactivity API for all dynamic functionality of the Twenty Twenty-One theme. Maybe that's helpful.
luisherranz commentedon Apr 7, 2024
You can process them using
wp_interactivity_process_directives🙂18 remaining items
michalczaplinski commentedon May 16, 2024
Based on discussion in #60979 (comment) I've opened a PR to add build configuration for a standalone package:
michalczaplinski commentedon May 16, 2024
I've started a PR to migrate
@wordpress/interactivity-routerto TS:fabiankaegy commentedon May 21, 2024
Hi all 👋
Reminder: The release candidate for Gutenberg Version 18.5 is scheduled for next Friday (May 31st). So anything that is supposed to make it into WordPress 6.6 must be merged by then.
Please raise any important issues that need additional attention :)
cbravobernal commentedon May 28, 2024
Hi 👋
I updated the description of the main tracking issue with the list of PRs that won't be included in this release, the PRs that still needs review or commit and the PRs ready for 6.6.
sirreal commentedon May 29, 2024
I've added WordPress/wordpress-develop#6453 as an enhancement for 6.6 (let Interactivity API be used in WP Admin).
cbravobernal commentedon May 29, 2024
I've added a unit test to the bug fix for the fatal error if a state or context uses a stdClass. Ready to review: 👀
WordPress/wordpress-develop#6672
cbravobernal commentedon Jun 7, 2024
Added a merged a bug fix for
data-wp-each-childpriority.wp-each-childpriority. #62293luisherranz commentedon Jul 8, 2024
Closing as finished.
The work for WordPress 6.7 will be tracked in the following tracking issue:
otakupahp commentedon Jul 17, 2024
The new version introduced a BIG error... Now instead of returning an object,
get_context()returns a stringsirreal commentedon Jul 17, 2024
@otakupahp Will you please open a new issue with details about the problem?
otakupahp commentedon Jul 17, 2024
I would love, but I spend that time tracking the error, and I'm terrible creating those issues. But I found the reason for it.
Before 6.6 I had an array with other arrays:
That create this JSON:
The Interactive API created a context object that contains the array without problems.
Now, it just renders a string instead of an array object
To fix the error, I have to modify my array into this:
Which created this JSON:
This is indeed parsed as an object.
SO, I must patch my code to make it work...
Maybe this was introduced on #6672
luisherranz commentedon Jul 17, 2024
I have created an issue to investigate this bug:
@otakupahp, could you please comment on that issue to provide a detailed list of the steps we need to take to reproduce the problem? Thank you.