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

Element: Add isEmptyElement utility function #9681

merged 2 commits into from Sep 12, 2018


None yet
3 participants

gziolo commented Sep 7, 2018


This PR exposed new isEmptyElement utility helper function in @wordpress/element packaged based on the suggestion from @aduth #9371 (comment):

In that case I'd rather just flag it as experimental.

My main issue is that, as far as anything in components is concerned, there should be zero awareness of what value an element holds. There is no commitment guaranteed by @wordpress/element that this shape is to remain, and will be hard to account for if ever changed. And we'd do well to avoid future headaches of plugin authors who follow similar practices to see how to accommodate this need by "solving" it internally for our own usage (as otherwise, they'll follow the same pattern and similarly face breakage whenever element structure changes).

I exposed it as stable API because it is used by @wordpress/components so I'm not quite sure if it really should be experimental.

How has this been tested?

npm test

@gziolo gziolo added this to the 3.9 milestone Sep 7, 2018

@gziolo gziolo self-assigned this Sep 7, 2018

@gziolo gziolo requested review from aduth and WordPress/gutenberg-core Sep 7, 2018


Makes sense to me; if we're using it for Slot it's not really experimental 😄

@aduth aduth merged commit 7af6f28 into master Sep 12, 2018

2 checks passed

codecov/project 49.18% remains the same compared to 9a6bf39
continuous-integration/travis-ci/pr The Travis CI build passed

@aduth aduth deleted the add/is-empty-element branch Sep 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment