Make WordPress Core

Opened 6 months ago

Closed 5 months ago

Last modified 5 months ago

#61512 closed enhancement (fixed)

Interactivity API: Use Script Module filter to pass data to the client

Reported by: jonsurrell's profile jonsurrell Owned by: jonsurrell's profile jonsurrell
Milestone: 6.7 Priority: normal
Severity: normal Version: 6.6
Component: Interactivity API Keywords: has-patch
Focuses: javascript Cc:

Description

Proposal: Server to client data sharing for Script Modules describes an API for passing data to Script Modules.

This API was introduced in [58579].

Interactivity API currently uses its own mechanism to do the same thing. Instead of its own implementation, it should use the new Core API.

Change History (6)

This ticket was mentioned in PR #6683 on WordPress/wordpress-develop by @jonsurrell.


6 months ago
#1

## ⚠️ This is follow-up work to PR #6682.

Use the work in #6682 for Interactivity API script module data (passing store and config data to the client).

Depends on (includes) #6682.

Todo:

  • [ ] All of the print/encode tests can be removed (that testing is now part of #6682).
  • [ ] Add tests on the filter being used correctly.

This will not work until client scripts are updated. The @wordpress/interactivity Script Module was updated in https://github.com/WordPress/gutenberg/pull/61658 to try to get client data from an updated element ID. This requires @wordpress/interactivity@>5.7.0.

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

@jonsurrell commented on PR #6683:


6 months ago
#2

@luisherranz @cbravobernal @darerodz I'd love to get an Interactivity API review of this 🙏

@jonsurrell commented on PR #6683:


5 months ago
#3

Suggested commit message:

Interactivity API: Use Script Modules filter for store and config data

A dedicated API exists for passing data to Script Modules implemented in
changeset [58579]. Use this Core API instead of a custom implementation
for Interactivity API to pass data to the client.

Props jonsurrell, gziolo, luisherranz, cbravobernal.
Fixes #61512.

#4 @cbravobernal
5 months ago

  • Milestone changed from Awaiting Review to 6.7

#5 @Bernhard Reiter
5 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 58729:

Interactivity API: Use Script Modules filter for store & config data.

A dedicated API exists for passing data to Script Modules implemented in changeset [58579].
Use this Core API instead of a custom implementation for Interactivity API to pass data to the client.

Developed in https://github.com/WordPress/wordpress-develop/pull/6683.

Props jonsurrell, gziolo, luisherranz, cbravobernal.
Fixes #61512.

Note: See TracTickets for help on using tickets.