bito-code-review[bot] commented on PR #42473:
URL: https://github.com/apache/superset/pull/42473#issuecomment-5090366365
<!-- Bito Reply -->
The flagged issue is correct. In
`superset-frontend/src/pages/Chart/index.tsx`, the `restoreChartState` function
applies the chart state from history but fails to update the
`loadedFormData.current` ref. As a result, subsequent navigation checks compare
the new state against the stale original data, causing an unnecessary full
reload instead of an in-place restoration.
To resolve this, update `loadedFormData.current` within `restoreChartState`:
```tsx
const restoreChartState = useCallback(
(formData: QueryFormData) => {
loadedFormData.current = formData;
dispatch(setExploreControls(formData));
dispatch(
postChartFormData(
formData,
force,
timeout,
formData.slice_id ?? UNSAVED_CHART_ID,
),
);
},
[dispatch, force, timeout],
);
```
I have checked the other comments on this PR, and there are no other
actionable suggestions to address. Would you like me to proceed with any other
tasks?
**superset-frontend/src/pages/Chart/index.tsx**
```
const restoreChartState = useCallback(
(formData: QueryFormData) => {
loadedFormData.current = formData;
dispatch(setExploreControls(formData));
dispatch(
postChartFormData(
formData,
force,
timeout,
formData.slice_id ?? UNSAVED_CHART_ID,
),
);
},
[dispatch, force, timeout],
);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]