vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.54k stars 27.05k forks source link

Invalid checksum with recharts #874

Closed geowarin closed 7 years ago

geowarin commented 7 years ago

I'm getting this error when rendering a chart made with recharts:

I've created a very simple repro.

My first reaction was to suspect a recharts bug. In particular, the isSsr function was my prime suspect.

I indeed do not get the same behavior when the code hits a if (isSsr()) condition.

But when thinking about it, the function seems legit. Another thing that puzzled me is that I don't get the same error when rendering with kyt. :anguished:

I'd love to have your opinion on this one, I'm getting pretty desperate.

geowarin commented 7 years ago

Actually, the error has to do with the size of the window containing the chart. It needs to be specified on the server-side for recharts to infer the animations or dynamic contents.

Sorry for wasting your time on this issue, @arunoda !

FWI, I could not reproduce the issue with kyt because the container had a fixed width defined in the template 😅

I'll write a little something here once I completely figure out the correct setup, in case somebody runs into the same issue. Recharts documentation is a little scarce on SSR.

arunoda commented 7 years ago

@geowarin I was about to tackle this now. So, no worries :)