[components] Fix use of undeclared react-icons dependency in story #2008
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.
Type of change (check at least one)
Does this change require a documentation update? (Check one)
Current behavior
Breaks if
react-icons
is installed in project at a non-2x version range.Description
A file inside of
@sanity/components
is requiring something fromreact-icons
without@sanity/components/package.json
having declared react-icons as a dependency.This usually works because of hoisting -
@react/base
has a dependency onreact-icons
, and usually lifts this dependency up to the root, which means@sanity/components
can find it and use it.However, when the user installs
react-icons
in their project and the version range does not match ours (2.x),react-icons
will be installed two places: inside of@sanity/base/node_modules
(2x) and inside of the studionode_modules
(3x/4x/whatever range they specified)Given that this is just a use inside of a story for storybook, the easy option was to use a different icon in this case.
Note for release
Checklist
[some-package] PR title (#123)