Update Icon component to support bundled dataviews package #70756
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
When using the DataViews component from
dataviews/wp
in a WordPress plugin, you can end up with icons not rendering properly. The reason is that the package bundles its own version ofcomponents
andprimitives
packages which means that the test to check whetherSVG
component is used fails (two different instances of SVG).I think that check is fragile to be honest and shouldn't have existed in the first place. We could in theory just pass "height"/"width" too all components (instead of "size") but to avoid disruptions and potential small breaking changes, I kept the "size" passing for now but just added the height/width props that way the rendering is not broken at least..
Testing instructions
There should be no impact here, but DataViews actions would look properly if used in a plugin.