esnet / react-timeseries-charts

Declarative and modular timeseries charting components for React
http://software.es.net/react-timeseries-charts
Other
861 stars 284 forks source link

YAxis tickCount re-render not working properly #371

Closed kradical closed 5 years ago

kradical commented 5 years ago

🐛Bug report

Hello again! I'm back with another bug for the YAxis component :stuck_out_tongue: . Thanks a ton for this project, we really enjoy it where I work. Thankfully I am here with a fix for the bug as well!

PR: https://github.com/esnet/react-timeseries-charts/pull/372

Describe the bug Basically when the tickCount prop changes on a YAxis component the component doesn't rerender properly. This is because in constructing the axis the generate function uses the old prop values instead of the new "nextProp" values.

To Reproduce Steps to reproduce the behavior:

  1. Render a chart with a YAxis
  2. Change the tickCount property over time (possibly with min and max as well)
  3. boom it goes super wonky using previous values.

Expected behavior It should render the axis correctly.

Screenshots On first render: screenshot from 2019-02-12 22-34-43 After changing tickCount/min/max: screenshot from 2019-02-12 22-34-52

See PR for fixed screenshots.

Desktop (please complete the following information):

Additional context https://github.com/esnet/react-timeseries-charts/pull/372

sartaj10 commented 5 years ago

@kradical Thanks for the issue and the PR as well. This is related to #346 and #370 as well right?

kradical commented 5 years ago

I believe this would fix #346 but not #370. It is somewhat related though in that re-rendering when props change is a common issue people have with the YAxis component. Thanks for your prompt reply.

kradical commented 5 years ago

PR merged!