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

[components] Fix use of undeclared react-icons dependency in story #2008

Merged
merged 1 commit into from
Sep 16, 2020

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Sep 16, 2020

Type of change (check at least one)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or update to documentation)
  • Maintenance
  • Other, please describe:

Does this change require a documentation update? (Check one)

  • Yes
  • No

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 from react-icons without @sanity/components/package.json having declared react-icons as a dependency.

This usually works because of hoisting - @react/base has a dependency on react-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 studio node_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

  • Fixed incorrect path for icon in a storybook story

Checklist

  • I have read the Contributing Guidelines
  • The PR title includes a link to the relevant issue
  • The PR title is appropriately formatted: [some-package] PR title (#123)
  • The code is linted
  • The test suite is passing
  • Corresponding changes to the documentation have been made

@vercel
Copy link

vercel bot commented Sep 16, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sanity-io/test-studio/6qw3r8aw6
✅ Preview: https://test-studio-git-components-icon-fix.sanity-io.vercel.app

Copy link
Member

@mariuslundgard mariuslundgard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rexxars rexxars merged commit 6d90ddb into next Sep 16, 2020
@rexxars rexxars deleted the components-icon-fix branch September 16, 2020 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants