nivo icon indicating copy to clipboard operation
nivo copied to clipboard

Tracking issue for removing `recompose` dependency

Open stephent opened this issue 4 years ago • 35 comments

Updating React now leads to a deprecation warning in the console:

react.development.js:315 Warning: React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.
    printWarning @ react.development.js:315
    warn @ react.development.js:278
    createFactoryWithValidation @ react.development.js:1827
    (anonymous) @ shouldUpdate.js:18
    pure @ pure.js:22
    (anonymous) @ compose.js:13
    enhance @ nivo-voronoi.esm.js:82
    ./node_modules/@nivo/voronoi/dist/nivo-voronoi.esm.js @ nivo-voronoi.esm.js:170

This is due to the recompose package which is still used for some of the nivo packages, we have to migrate the following packages to React hooks (providing the same features) to get rid of it:

  • [ ] Core
  • [x] Pie
  • [x] Voronoi (#1364)
  • [ ] Waffle
  • [x] Bullet (#1252)
  • [x] Bar (#1619)
  • [x] Circle Packing (#1360)
  • [x] Sunburst (#1264)
  • [x] Calendar
  • [x] Legends (Listed in package.json, but not used)

stephent avatar Feb 28 '20 17:02 stephent

Im getting same warning

codler avatar Mar 02 '20 18:03 codler

Getting the same issue, How to remove the error

abhaykumar01234 avatar Mar 06 '20 22:03 abhaykumar01234

Same issue :(

hichana avatar Mar 24 '20 07:03 hichana

Same here :(

neverdane avatar Mar 24 '20 14:03 neverdane

Same...

jungans avatar Mar 25 '20 14:03 jungans

This isn't a direct problem with the nivo packages, but instead of with one of its dependencies: recompose.

Specifically recompose/shouldUpdate: https://github.com/acdlite/recompose/blob/master/src/packages/recompose/shouldUpdate.js#L6

and recompose/withPropsOnChange: https://github.com/acdlite/recompose/blob/master/src/packages/recompose/withPropsOnChange.js#L9

Unfortunately, the recompose package appears to be mostly unmaintained. It's recommended to replace this package with some hooks.

mattcarlotta avatar Mar 26 '20 19:03 mattcarlotta

Reading recompose readme, it suggest you use React Hooks instead

codler avatar Mar 26 '20 20:03 codler

Same

AmmarHSufyan avatar Mar 30 '20 17:03 AmmarHSufyan

There is a PR fixing this issue at recompose repository waiting to be merged for over a month https://github.com/acdlite/recompose/pull/795

jungans avatar Apr 09 '20 02:04 jungans

Any updates on this? It's still showing in version 0.61.1

nigellima avatar May 18 '20 04:05 nigellima

It's still showing to me too. Warning: React.createFactory() is deprecated. I am still waiting for a solution.

ElderLK avatar May 18 '20 13:05 ElderLK

The solution from our end is to move away from recompose as a dependency. Which some charts already are using hooks instead. There are still a bunch of charts using this method, so it will take some time to get them all converted.

If anyone is interested in converting one, please don't hesitate to open a PR. Here is an example of a commit where this was done: https://github.com/plouc/nivo/commit/51a58c114b22961dcca6dfe9e52494c8336e0f22

wyze avatar May 18 '20 13:05 wyze

Can someone make a list of the components that need a move away from recompose?

IzioDev avatar Jul 31 '20 11:07 IzioDev

Packages list moved to main description.

wyze avatar Jul 31 '20 14:07 wyze

recompose now also has a dos security flaw being flagged with its deep dependency on node-fetch.

https://github.com/plouc/nivo/issues/1129

shezzor avatar Oct 07 '20 10:10 shezzor

I am willing to help contribute getting some of the list that @wyze mentions above converted over to a hooks-based implementation... but I do not want to invest that time if we have no chance of getting that work merged/published. The last published NPM release for Nivo was in 2017.

@plouc if we get this work done to where we can drop the recompose dependency, will we be able to get a new package published?

Yes, I am aware that we could declare the dependency in package.json as the forked and updated repo... I would rather not do that, and I do not want to be responsible for anyone who ends up pointing to that fork.

brianespinosa avatar Oct 14 '20 15:10 brianespinosa

@brianespinosa while I agree I haven't been really reactive lately due to personal constrains, the latest release is from 4 months ago, I guess you referring to the old nivo package VS the scoped ones @nivo/x.

I understand that it can be quite frustrating to contribute on projects and to get no feedback or release including your work (I've experienced it too), and I really apologize for this.

I'll try to release something as soon as I can, but I prefer to not give a date, as each time I did, I had other priorities and could not release.

Unfortunately, forking would not work, you cannot point to repo packages directly as they have to be compiled, and the generated artifacts are ignored, also, as you mentioned, this approach has drawbacks and I would definitely not recommend doing this even if that was feasible.

plouc avatar Oct 14 '20 16:10 plouc

@brianespinosa, I'm currently working on the state of CSS/JS surveys and I usually spend some time on nivo too as they use a lot of dataviz, so this should happen soon enough.

plouc avatar Oct 14 '20 16:10 plouc

Thanks @plouc

In this case, I am going to let some of my team know that we can target some of these charts for refactoring. I can report back in about a week with where some of my team want to focus their efforts so we can coordinate.

brianespinosa avatar Oct 14 '20 16:10 brianespinosa

Now removed from @nivo/pie.

plouc avatar Nov 06 '20 08:11 plouc

I'm getting this in 0.67.0 and I'm using @nivo/core and @nivo/line. My package-lock.json states that recompose is used by @nivo/core.

anton-johansson avatar Dec 16 '20 10:12 anton-johansson

I am also getting in 0.67.0. I am getting this as security vulnerability for @nvivo/bar.

Meaheesha avatar Dec 18 '20 06:12 Meaheesha

Please note that until this list is fully completed, you're going to get those warnings, we're aware and working on it!

@wyze took care of the @nivo/sunburst package.

plouc avatar Dec 18 '20 11:12 plouc

@nivo/circle-packing has been migrated (pending PR)

plouc avatar Dec 23 '20 08:12 plouc

@nivo/voronoi has been migrated (pending PR)

plouc avatar Dec 24 '20 02:12 plouc

Just to let you know guys, I got this warning in @nivo/heatmap "^0.67.0", I'm using responsive canvas. ty in advance.

falsepopsky avatar Jan 04 '21 20:01 falsepopsky

Any news on @nivo/bar ? I'm still having the warning in "@nivo/bar": "^0.66.0"

GregdTd avatar Jan 05 '21 13:01 GregdTd

Just bumping, looks like this is happening in core which is still showing in this issue as not refactored yet.

console.warn
    Warning: React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.
    ...
    ...
   at enhance (node_modules/@nivo/voronoi/src/enhance.js:19:5)

JacobMGEvans avatar Feb 03 '21 19:02 JacobMGEvans

Hi, I'm getting this warning using only @nivo/core and @nivo/line but I don't see either of them in the list, are they planned for refactoring as well? Sorry if I missed something in this discussion but I would like to be sure.

cfecherolle avatar Feb 19 '21 10:02 cfecherolle

I saw that @plouc expanded the initial issue I reported, but like @cfecherolle I'm only using @nivo/core and @nivo/line also, so I believe they (or one of them) should be included in the list too?

stephent avatar Feb 20 '21 00:02 stephent