Need a special offer?Find out if your project fits.
+

Flexmonster + react-query

Answered
Oleg asked on December 6, 2020

I attached screenshot. How I can prevent rerender? useDashboardData uses react-query for data fetching.
setChart - it's highcharts.getData

4 answers

Public
Vera Didenko Vera Didenko Flexmonster December 8, 2020

Hello, Oleg, 
 
Thank you for reaching out to us. 
 
Could you please describe the issue in a bit more detail? Which actions cause the rerender and where does the rerender occur?
Also, could you please provide us with a code example where the issue is reproducible?
More insight will help us to make further progress in solving this case.
 
Looking forward to your response.
 
Kind regards, 
Vera

Public
Oleg December 8, 2020

Hi, Vera. flexmonster draw chart with callback. in this callback i need to get raw data and set it to chart object. but i dont have global chart object and need to keep chart state in local state of react called "chartData".
1.flexmonster call my drawChart callback
2. drawChart callback sets data to local state
3. data from this local state goes to chart component and chart component starts rendering.
4. when local state changes, my main dashboard component with pivot starts rerender.
5.dashboardData.isLoading on second render give us "false" because it loads data on first render and now in "idle" state.
6.table.setReport (i.e. flexmonsterRef.current?.flexmonster.setReport(dashboardData)) starts working and updates table.
7. on table update table.setChart (i.e. flexmonsterRef.current?.flexmonster.highcharts?.getData)) calls callback.
8. go to step 2.

Public
Vera Didenko Vera Didenko Flexmonster December 10, 2020

Hello, Oleg,
 
Thank you for providing more details on your case.
 
So far, we have not managed to reproduce the same behavior on our end. 
Do you think you could please provide us with a sample project where the issue is reproducible (this can be done via email)?
This will greatly help us to provide a solution faster.
 
Thank you in advance!
Looking forward to your response.
 
Kind regards, 
Vera

Public
Vera Didenko Vera Didenko Flexmonster December 17, 2020

Hello, Oleg,
 
Our team would like to kindly take an interest in whether you managed to resolve the issue.
If the issue still persists and the rerender occurs, could you please provide a sample project where the issue is reproducible?
 
Please let us know if everything works.
Looking forward to your response.
 
Kind regards, 
Vera

Please login or Register to Submit Answer