Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#61512 closed enhancement (fixed)

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

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

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.


2 years 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:


2 years ago
#2

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

​@jonsurrell commented on ​PR #6683:


2 years 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
2 years ago

  • Milestone Awaiting Review → 6.7

#5 @Bernhard Reiter
2 years ago

  • Resolution → fixed
  • Status assigned → 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.