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

Bug in layers: series order changes during the rendering #1463

Closed
Deliaz opened this issue Apr 1, 2021 · 2 comments · Fixed by #1644
Closed

Bug in layers: series order changes during the rendering #1463

Deliaz opened this issue Apr 1, 2021 · 2 comments · Fixed by #1644
Labels
bug 📈 line @nivo/line package

Comments

@Deliaz
Copy link

Deliaz commented Apr 1, 2021

Issue Demo: https://codesandbox.io/s/nivo-line-graph-component-forked-nn322?file=/src/index.js
Version: 0.67.0

The example above shows a possible bug with the order of series items in custom layer props.

The order in the sync phase is reversed from what we get at the end of rendering (next cycle of event loop).

...
layers={[
    "grid",
    "markers",
    "axes",
    "areas",
    (props) => {
      // Let's log first element from series
  
      // sync log
      console.log(props.series[0].id); // logs: japan
  
      // next loop log
      setTimeout(() => {
        console.log(props.series[0].id); // logs: norway
      }, 0);
  
      return null;
    },
    ...
]}
...
@Deliaz
Copy link
Author

Deliaz commented May 6, 2021

This bug also breaks the official custom layer example:
https://nivo.rocks/storybook/?path=/story/line--custom-layers
Hover over the chart to see how it changes.

@TomasB
Copy link

TomasB commented Dec 15, 2021

@wyze while it fixes the official example and the provided sample, it seems that there is still some gap somewhere.. We are reproducing the issue in our code, and I'm still looking what exactly causes that behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 📈 line @nivo/line package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants