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

setFilter() promise doesn't wait for chart to update #53

Open
NGPixel opened this issue Oct 14, 2021 · 3 comments
Open

setFilter() promise doesn't wait for chart to update #53

NGPixel opened this issue Oct 14, 2021 · 3 comments

Comments

@NGPixel
Copy link

NGPixel commented Oct 14, 2021

Describe the bug
When calling setFilter() on an existing chart, the returned promise completes immediately instead of waiting for the chart to actually update.

This makes it impossible to show a loading message to the user while the chart is updating. The chart just stays in its current state until the new data is loaded, which is very confusing to the user as it can take several seconds to do so depending on the chart/filters.

To Reproduce
Steps to reproduce the behavior:

  1. Create a chart and call render()
  2. Set new filters on the existing chart using setFilter()
  3. Promise returns right away even though the chart hasn't updated yet.

Expected behavior
The promise should wait for the chart to be updated before succeeding.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Version: 94

SDK Version
2.1.0

@khanguslee
Copy link
Collaborator

Thank you for raising this issue with us @NGPixel. The team has been notified about this problem and we have created an internal ticket to resolve this.

@imaireaux
Copy link

imaireaux commented Sep 28, 2022

I have another question related to this issue.
I'm trying to use chart.getData(), and it works. But I don't know when to call it.
Typically I want to do something like this

chart
      .setFilter(customFilter)
      .then(() => { chart.getData() })

Here it always return the previous filter data.
Is there any way to have a callback triggered when the chart is loaded and we can fetch data ?

Note : I guess that the same is true with chart.render

@khanguslee
Copy link
Collaborator

@imaireaux Thanks for raising this issue. It looks like I can replicate it in the code sandbox example by selecting a country filter and then quickly clicking on 'Get Chart Data'.

I'll go back to the team and bring this issue up.

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

No branches or pull requests

3 participants