question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

window is not defined, when using @nivo/pie in Next.JS

See original GitHub issue

Describe/explain the bug It doesn’t seem like the pie chart @nivo/pie supports server side rendering. Others however such as line do.

To Reproduce

  1. Create a new next app yarn create next-app
  2. Add pie charts yarn add @nivo/pie
  3. Go inside pages and edit the index.js to import Pie and try using it with <Pie/>

Expected behavior The Pie chart renders server side and all is good.

Screenshots image image

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Edge
  • Version: @nivo/pie: ^0.64.0

Thank you!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
plouccommented, Nov 15, 2020

@gomorizsolt, I’m gonna try to release tomorrow.

0reactions
gomorizsoltcommented, Nov 15, 2020

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: ResizeObserver is not defined with nivo and ...
It looks like @nivo/pie is not compatible with Next.js server-side rendering as it utilizes Web APIs ( ResizeObserver ).
Read more >
How to solve Next.js window is not defined
One way is to not use window at all when rendering the page, but that isn't practical. Let's look at some actual solutions...
Read more >
How to use nivo charts with Next.js - Learn JSX
In this tutorial, we will show how to use nivo with Next.js to draw charts like pie charts and line charts, also how...
Read more >
Tooltip Doesn't Function like Dev on Next.js Build #1397
When I use nivo scatterplot and pie charts and import them into my next.js project, the tooltips render correctly and follow my cursor...
Read more >
How to solve "window is not defined" errors in React and Next.js
A different solution is to load your Scroll component using dynamic imports and the srr: false option. This way your component won't even...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found