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

[Issue][v3.beta.11] strict order of updating options and data. #8515

Closed
xr0master opened this issue Feb 24, 2021 · 1 comment · Fixed by #8516
Closed

[Issue][v3.beta.11] strict order of updating options and data. #8515

xr0master opened this issue Feb 24, 2021 · 1 comment · Fixed by #8516
Milestone

Comments

@xr0master
Copy link
Contributor

Hey guys, there is some behavior associated with this line.
https://github.com/chartjs/Chart.js/blob/master/src/core/core.controller.js#L162

During the options setter, some update mechanism is started even before the chart.update function was called. If there is a dependence on data, this causes an issue, when options were updated incorrectly. Because of this, it is mandatory to update data before the options are updated.

Expected Behavior

It is expected that data and options can be updated in any order. Should not be affected while the update function has been called.

Current Behavior

If you update options before data, an error occurs.

Steps to Reproduce

The error was found by one of the wrapper users. I will add a link, maybe this will give you more data for analysis.
xr0master/chartjs-react#10

https://codesandbox.io/s/damp-surf-znpnz
This playground uses a wrapper, but it doesn't really matter. The important thing is that if you update data and then the options, the bug with the axes does not occur. Two different versions of the wrapper are used to show the issue: [options, data], [data, options].

Environment

  • Chart.js version: beta.11

Thanks for @ace-han investigation

@xr0master xr0master changed the title [Issue][v3] strict order of updating options and date. [Issue][v3.beta.11] strict order of updating options and date. Feb 24, 2021
@xr0master xr0master changed the title [Issue][v3.beta.11] strict order of updating options and date. [Issue][v3.beta.11] strict order of updating options and data. Feb 24, 2021
@kurkle
Copy link
Member

kurkle commented Feb 24, 2021

Thanks for the detailed report, the bug seems obvious!

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

Successfully merging a pull request may close this issue.

3 participants