You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get infinite rerenders when i use useInstanceId() in my custom block and save it to an attribute if it changes.
for testing purpose i created a block using pnpx @wordpress/create-block@latest --variant dynamic and change the edit.js to this:
In the template preview in the site editor (/wp-admin/site-editor.php?postType=wp_template) my block flickers and in the console I see infinite rerenders. The error only occurs when my block is in a Temaplte part.
Am I doing something wrong or is there a bug because it does a render every time I save the attribute. He doesn't do that in the block editor.
Step-by-step reproduction instructions
Use default Theme and WP 6.6
create a block using @wordpress/create-block@latest
edit the edit.js as described above
go to the template preview
go to the console
Screenshots, screen recording, code snippet
Bildschirmaufnahme.2024-07-18.um.16.50.43.mov
Environment info
WordPress Studio
WordPress 6.6
PHP 8.1
Theme: Twenty Twenty-Four
no Plugins besides the custom block plugin
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Description
I get infinite rerenders when i use
useInstanceId()in my custom block and save it to an attribute if it changes.for testing purpose i created a block using
pnpx @wordpress/create-block@latest --variant dynamicand change theedit.jsto this:In the template preview in the site editor (/wp-admin/site-editor.php?postType=wp_template) my block flickers and in the console I see infinite rerenders. The error only occurs when my block is in a Temaplte part.
Am I doing something wrong or is there a bug because it does a render every time I save the attribute. He doesn't do that in the block editor.
Step-by-step reproduction instructions
@wordpress/create-block@latestScreenshots, screen recording, code snippet
Bildschirmaufnahme.2024-07-18.um.16.50.43.mov
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.