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

Multiple warnings when using Nivo >= 0.85.0 line chart #2539

Closed
pitininja opened this issue Mar 13, 2024 · 21 comments · Fixed by online-go/online-go.com#2629 or #2576
Closed

Multiple warnings when using Nivo >= 0.85.0 line chart #2539

pitininja opened this issue Mar 13, 2024 · 21 comments · Fixed by online-go/online-go.com#2629 or #2576

Comments

@pitininja
Copy link

pitininja commented Mar 13, 2024

Describe/explain the bug

A bunch of warnings related to default props are thrown in the console after upgrading Nivo to v0.85.0 and using the line chart.

Example of warning :

Warning: Failed prop type: The prop `layers` is marked as required in `We`, but its value is `undefined`.
We@https://8dh6jx.csb.app/node_modules/@nivo/line/dist/nivo-line.es.js:721:11
n@https://8dh6jx.csb.app/node_modules/@nivo/core/dist/nivo-core.es.js:1897:16
div
Jt@https://8dh6jx.csb.app/node_modules/@nivo/core/dist/nivo-core.es.js:1403:11
Pe
div
App

To Reproduce

Sandbox : https://codesandbox.io/p/sandbox/nivo-line-chart-bottom-tick-values-forked-8dh6jx

Steps to reproduce the behavior:

  1. Use Nivo >= 0.85.0 (@nivo/core and @nivo/line)
  2. Use a ResponsiveLine component without specifying all the available props
  3. Open the console and see the multiple warnings

Expected behavior

No warnings in the console because the related props are not required.

Screenshots

image

Desktop :

  • OS: Kubuntu 23.10
  • Browser: Firefox 123.0.1
  • Version 0.85.0

Additional context

This problem occurs after upgrading to v0.85.0, I didn't had the problem with previous versions.

@ryanmio
Copy link

ryanmio commented Mar 14, 2024

I am having this same issue. Been troubleshooting since yesterday and not found a good fix. I'll stay tuned here.

ryanmio added a commit to ryanmio/PumpkinPal that referenced this issue Mar 14, 2024
Resolved a series of prop type warnings encountered in the LineChart component due to compatibility issues with the latest version of @nivo/line. After identifying a similar issue reported by the community on GitHub (plouc/nivo#2539), we decided to downgrade @nivo/line to version 0.84.0.
@GreenAsJade
Copy link

^^ that's the likely cause.

@hilyas786
Copy link

having the same isssues

@Evirtual
Copy link

Evirtual commented Apr 2, 2024

I can confirm that adding missing props solves the issue.

@GreenAsJade
Copy link

Do you mean "adding all the optional props in the client code explicitly"? If so, that's not really a "solution" :)

@hilyas786786
Copy link

adding in all the props is the only way to get rid of the console warnings currently

@GreenAsJade
Copy link

Or - drop back to the previous version until the bug is fixed 😝

That's what I've done.

@mswezey23
Copy link

Damn... well... misery loves company and here we are <3

FML... I migrating from cra/craco to vite and updating all my libs in on shot was not ideal. This wasn't the only lib to break on update. Optimizely had to be downgraded and so did Playwright, both had regressions.

Gonna go back on this one too. PR is already big enough.

@codeams
Copy link

codeams commented Apr 9, 2024

if you go back to the previous version you get back to get the "defaultProps" deprecated warning (depending on your version of react).

@codeams
Copy link

codeams commented Apr 9, 2024

what could I set as "tooltip" and "sliceTooltip" props to get rid of their warnings without affecting the behavior of the line chart component?

forresttanaka added a commit to IGVF-DACC/igvf-ui that referenced this issue Apr 11, 2024
* Update npm packages.
* Update nivo npm packages.
* Add description to CuratedSet search results.
* Use description as the title of search results, and use the file_set_type if no description exists.
* Fix the CuratedSet list-view Jest test.
* Revert to older version of nivo charts because they still have a propTypes bug: plouc/nivo#2539
@m3360202
Copy link

dude,i've resolve this problem by update nodejs to version 18.0.0 above, i use 18.2.0 now,and this function can render svg/canvas components normally

@m3360202
Copy link

it seems that nodejs 17 may trigger this multiple errors

@hilyas786786
Copy link

im using node js 21, still get the same console.log warnings

@qm210
Copy link

qm210 commented Apr 15, 2024

Same.

Can this be interpreted - no offense please - as "the devs do not really use this project themselves (anymore)"? Which can happen everywhere, but in that case, a deprecation warning on the front page would be nice, I guess.

forresttanaka added a commit to IGVF-DACC/igvf-ui that referenced this issue Apr 15, 2024
* Update npm packages.
* Update nivo npm packages.
* Add description to CuratedSet search results.
* Use description as the title of search results, and use the file_set_type if no description exists.
* Fix the CuratedSet list-view Jest test.
* Revert to older version of nivo charts because they still have a propTypes bug: plouc/nivo#2539
forresttanaka added a commit to IGVF-DACC/igvf-ui that referenced this issue Apr 15, 2024
… view (#470)

* Update npm packages.
* Update nivo npm packages.
* Add description to CuratedSet search results.
* Use description as the title of search results, and use the file_set_type if no description exists.
* Fix the CuratedSet list-view Jest test.
* Revert to older version of nivo charts because they still have a propTypes bug: plouc/nivo#2539
@Ojay
Copy link

Ojay commented Apr 17, 2024

I'm also experiencing this with @nivo/line 0.85.1 - node V20.11.

Downgrading to @nivo0.84.0 removed a ton of warnings, but introduced the Support for defaultProps error that @codeams mentioned.

@nikitadubyk
Copy link

I'm also experiencing this with @nivo/line 0.85.1 - node V20.11.

Downgrading to @nivo0.84.0 removed a ton of warnings, but introduced the Support for defaultProps error that @codeams mentioned.

Same issue

@Magdan4ik
Copy link

The same issue here with node 20.11 & @nivo/line 0.85.1.
Any updates?

@codeams
Copy link

codeams commented Apr 22, 2024

As the project I'm working on uses TS I suppressed warnings using a hook:

import { useEffect } from 'react'

const useSuppressConsoleWarnings = () => {
  useEffect(() => {
    const originalConsoleWarn = console.error

    console.error = (message, ...args) => {
      if (
        message.includes('Warning: Failed %s type: %s%s')
      ) {
        return
      }
      originalConsoleWarn(message, ...args)
    }

    return () => {
      // Restore original console.error on cleanup
      console.error = originalConsoleWarn
    }
  }, [])
}

export default useSuppressConsoleWarnings

It uses useEffect to ensure the warning is supresed in the client in case you're using server components.

You can bring this hook into components that use @nivo/line.

Hopefully this is resolved soon, but if you take a look at nivo projects in github, you'll notice the intention to move @nivo/line to TS has been open for more than a couple of years. It doesn't seem simple so I don't think this will be resolved in the short term.

Downgrading the react/node version is not a satisfactory solution, as warnings of "defaultProps" being deprecated might appear instead. In fact, the attempt to solve this deprecation warning is what triggered this even more annoying issue.

@GreenAsJade
Copy link

Thanks for sharing that. We'll stick on 0.84 till something compelling makes us move, but that's handy to know.

@mib00038
Copy link

Unfortunately, 0.84 contains multiple high severity ReDoS vulnerabilities related to the d3-color dependency.

@GreenAsJade
Copy link

Great news! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet