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

Playground: Fix useEffect to only registerCoreBlocks once #18514

merged 1 commit into from Nov 14, 2019


Copy link

ItsJonQ commented Nov 14, 2019


Screen Shot 2019-11-14 at 3 22 33 PM

Fix console/render issues in Playground (Storybook). The issue was the useEffect hook was firing multiple times, causing the registerCoreBlocks to re-register over and over.

How has this been tested?

Tested in Storybook!


  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR. .

Resolves: #18512

Copy link

youknowriad left a comment

Makes sense

@ItsJonQ ItsJonQ self-assigned this Nov 14, 2019
@ItsJonQ ItsJonQ merged commit 97c213d into master Nov 14, 2019
2 checks passed
2 checks passed
Travis CI - Pull Request Build Passed
@ItsJonQ ItsJonQ deleted the fix/18512/playground-block-reregistering branch Nov 14, 2019
Copy link

gziolo left a comment

Thanks for fixing.

I see it now in docs:

Yes! By default, it runs both after the first render and after every update. (We will later talk about how to customize this.) Instead of thinking in terms of “mounting” and “updating”, you might find it easier to think that effects happen “after render”. React guarantees the DOM has been updated by the time it runs the effects.

I totally forgot about it 👍

@youknowriad youknowriad added this to the Gutenberg 7.0 milestone Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.