-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query Filter: Update to match new Interactivity API format #563
Conversation
7e16206
to
f40f856
Compare
51b8e39
to
9ca0663
Compare
f7d72eb
to
5f5c3a8
Compare
@@ -1,8 +1,7 @@ | |||
/** | |||
* WordPress dependencies | |||
*/ | |||
import { __, sprintf } from '@wordpress/i18n'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module build is not compatible with importing from other @wordpress/*
packages, trying was giving me this error:
Module not found: Error: Attempted to use WordPress script in a module: @wordpress/i18n, which is not supported yet.
The workaround is to pass the label as a data attribute on the element from render.php
. I don't think we'll need to do this forever, as this is currently being iterated on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got this working after some considerable config!
I needed to use WordPress/wporg-showcase-2022#268 and Gutenberg 17.5.2 (latest).
Filters work for me, I didn't test the screenshots specifically, but the errors went away after I updated Node and rebuilt everything.
The Interactivity API changes look ok to me but I'm still not familiar with the API at this stage.
Haven't tested with Events.
This is a workaround for i18n functions, since they can't be imported into a module
8a45a04
to
d77ef00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the built files with Gutenberg 17.5.3
on my events.wordpress.org sandbox (w.org, not local). Everything looks good 👍🏻
There have been multiple changes to the Interactivity API since it was first used in the Query Filter blocks.
viewModule
property in block.json (this will probably change toviewScriptModule
soon, but both will continue to work).store()
call is different, and the paths to data are updated— ex,effects.wporg.queryFilter.init
is noweffects.init
.getContext
function.data-wp-effect
is nowdata-wp-watch
See WordPress/gutenberg#52906 (comment), WordPress/gutenberg#57492.
Important
This requires a solution that lets us update Gutenberg to 17.5+ (for the viewModule registration), without breaking the Support Forums— like #561
To test