nivo icon indicating copy to clipboard operation
nivo copied to clipboard

React 18 Support

Open benrhere opened this issue 4 years ago • 29 comments

Is your feature request related to a problem? Please describe. I'd like to be able to use nivo with React 18 which was released on 3/29. Today, the nivo dependencies are such that React 18 causes errors like the following when running "npm update":

npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@">= 16.14.0 < 18.0.0" from @nivo/[email protected]
npm ERR! node_modules/@nivo/core
npm ERR!   @nivo/core@"0.79.0" from the root project
npm ERR!   peer @nivo/core@"0.79.0" from @nivo/[email protected]
npm ERR!   node_modules/@nivo/bar
npm ERR!     @nivo/bar@"0.79.1" from the root project
npm ERR!   1 more (@nivo/tooltip)

Describe the solution you'd like I think bumping the React dependency should hopefully address this.

Describe alternatives you've considered Running "npm update --force" seems to circumvent this problem for now.

Additional context Thanks for all your work on this terrific library!

benrhere avatar Mar 30 '22 22:03 benrhere

Running into this problem too. Current workaround is to use legacy-peer-deps

https://github.com/plouc/nivo/blob/f83ad7bd26b0df489486771ac9ee28f99fff449f/package.json#L83-L87

@plouc @wyze Thank you for this amazing library 🙏

sshquack avatar Apr 01 '22 00:04 sshquack

How can I change the crosshair color? I only see it's black. It won't work for the dark mode sites. Thank you

grimmie38 avatar Apr 01 '22 01:04 grimmie38

Is there anything preventing this over upgrading the dependency versions?

cameron-martin avatar Apr 06 '22 14:04 cameron-martin

Is there anything preventing this over upgrading the dependency versions?

Probably just some testing first to ensure that there aren't any breaking changes with 18.

singularitypress avatar Apr 16 '22 22:04 singularitypress

Appears React 18 support has since been added to react-spring: https://github.com/pmndrs/react-spring/pull/1875

Hopefully that gets us a bit closer

benrhere avatar May 05 '22 22:05 benrhere

I created https://github.com/plouc/nivo/pull/2008/files to bump peer dependencies, though I'm not sure if more work is needed to achieve React 18 compatibility but hopefully this moves things in the right direction.

benrhere avatar May 17 '22 23:05 benrhere

Has React 18 support arrived?

Gerald12344 avatar May 25 '22 09:05 Gerald12344

I just tried --force installing it but then got "Invalid hook call" errors in the browser :( Very much looking forward to React 18 support 🙏

netbizltd avatar Jun 02 '22 12:06 netbizltd

I'm also looking forward to React 18 support over here 👍🏻

aitorres avatar Jun 17 '22 04:06 aitorres

@netbizltd I tried --froce as well and it works fine. i don't see why there would be invalid hook call errors, that sounds like something unrelated to nivo. I mean react 18 only adds concurrent mode, don't see why there would be any breaking changes unless you're using the new react 18 concurrent features with the charts specifically. React concurrent will only be enabled on branches where concurrent features are being used so theoretically it should be safe as long as your react component with nivo charts doesn't use the new react 18 features. React 18 was designed in mind so you could gradually upgrade your app to be concurrent where possible. That's one of the great things about it. or are people here just really looking forward to using new transitions and concurrency with nivo charts?

Cpt-Falcon avatar Jun 21 '22 19:06 Cpt-Falcon

Upgrading the whole repo to use React 18 isn't trivial, because storybook needs upgrading to a version that supports React 18. However, this requires replacing the deprecated @storybook/addon-info and @storybook/addon-knobs. Both of these require upgrading to the component story format, which is quite a big change.

However, as a first step, we could upgrade the constraints on the packages, but still use React 17 in the repository for things such as testing.

cameron-martin avatar Jun 24 '22 11:06 cameron-martin

have the same problem subscribe

politsin avatar Jul 18 '22 10:07 politsin

Upgrading the whole repo to use React 18 isn't trivial, because storybook needs upgrading to a version that supports React 18. However, this requires replacing the deprecated @storybook/addon-info and @storybook/addon-knobs. Both of these require upgrading to the component story format, which is quite a big change.

However, as a first step, we could upgrade the constraints on the packages, but still use React 17 in the repository for things such as testing.

How about just creating a react 18 branch where you dump the storybooks? Then at a later time when upgrading becomes more manageable, you can bring addon info and knobs back in. Create a package called like nivo-react18-experimental

Cpt-Falcon avatar Jul 19 '22 16:07 Cpt-Falcon

Is there any update? I have to use --legacy-peer-deps option on every npm install in my repo.

hayyaun avatar Aug 15 '22 11:08 hayyaun

@plouc would you be able to create a new release based on the merged changes in https://github.com/plouc/nivo/pull/2056

It is already in the master branch, I cannot see why a new release cannot be created from it.

luke9216 avatar Aug 23 '22 10:08 luke9216

A new release was created with the updated constraints.

plouc avatar Sep 10 '22 01:09 plouc

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Dec 16 '22 01:12 stale[bot]

bump

cameron-martin avatar Dec 16 '22 09:12 cameron-martin

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

stale[bot] avatar Dec 26 '22 03:12 stale[bot]

The stale bot is broken?

cameron-martin avatar Dec 26 '22 11:12 cameron-martin

bump again?

politsin avatar Dec 26 '22 13:12 politsin

Still seeing this issue, please re-open

jedahan avatar Jan 23 '23 17:01 jedahan

Any update here? I'm getting an Invalid Hook call error thrown from @nivo/tooltip/src/Tooltip.tsx:7 when using ResponsivePie with [email protected].

Package versions are: @nivo/[email protected], @nivo/[email protected], @nivo/[email protected]

tappyy avatar Mar 29 '23 15:03 tappyy

bump

jwj777 avatar Apr 23 '23 07:04 jwj777

Same here

PerryRylance avatar May 24 '23 10:05 PerryRylance

Is this resolved for real now or just marked stale?

onionhammer avatar Aug 02 '23 14:08 onionhammer

any updates, for react18 support?

OsmelSynData avatar Oct 24 '23 08:10 OsmelSynData

any updates, for react18 support?

I managed to find work around the problem by not upgrading to yarn berry (yarn 2). I don't know if you guys also had the same issue with yarn but react 18 was not a problem for me.

Here are the version Im using if anyone wants to try it out. Also it would be nice to know why yarn seems to be the issue. "@nivo/core": "0.83.0" "react": "^18.2.0", yarn --version => 1.22.19

OsmelSynData avatar Oct 25 '23 08:10 OsmelSynData

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Mar 13 '24 09:03 stale[bot]