Skip to content
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

Interactivity API - Random directive parsing errors v19.5.0 #66490

Closed
3 of 6 tasks
poof86 opened this issue Oct 25, 2024 · 2 comments
Closed
3 of 6 tasks

Interactivity API - Random directive parsing errors v19.5.0 #66490

poof86 opened this issue Oct 25, 2024 · 2 comments
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Bug An existing feature does not function as intended

Comments

@poof86
Copy link

poof86 commented Oct 25, 2024

Description

After updating to Gutenberg 19.5.0 from 19.4.0 I get errors when elements with directives get parsed.
The errors disappear when I downgrade back to 19.4.0

I get errors like:
directives.tsx:574 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'map')
for elements that have the data-wp-each-child attribute

and the error:
directives.tsx:480 Uncaught TypeError: Cannot use 'in' operator to search for 'hidden' in null
for elements that have the data-wp-bind--hidden attribute set

What changed for this to happen?

Step-by-step reproduction instructions

Created a custom block with a render.php where these directives are used.
The viewScriptModule file view.js uses the following assets.php
<?php return array('dependencies' => array('@wordpress/interactivity', array('id' => '@wordpress/interactivity-router', 'import' => 'dynamic')), 'version' => 'e60eae253fd57d3f', 'type' => 'module');
on page load I now get these errors why I didn't with 19.4.0

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@poof86 poof86 added the [Type] Bug An existing feature does not function as intended label Oct 25, 2024
@gziolo gziolo added the [Feature] Interactivity API API to add frontend interactivity to blocks. label Nov 1, 2024
@poof86
Copy link
Author

poof86 commented Nov 8, 2024

It seems that v19.6.0 fixes this bug

Was it because the delayed hydration was added?

Thanks!

@poof86 poof86 closed this as completed Nov 8, 2024
@michalczaplinski
Copy link
Contributor

Hi @poof86 ! Apologies for the late reply.

I believe this might have been caused by #66691 which was fixed in #66772 that just shipped in 19.6. Glad that solved your issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants