LevisNgigi commented on code in PR #35998:
URL: https://github.com/apache/superset/pull/35998#discussion_r2523198128
##########
superset-frontend/src/components/Chart/chartAction.js:
##########
@@ -422,6 +424,14 @@ export function exploreJSON(
dispatch(updateDataMask(formData.slice_id, dataMask));
};
dispatch(chartUpdateStarted(controller, formData, key));
+ /**
+ * Abort in-flight requests after the new controller has been stored in
+ * state. Delaying ensures we do not mutate the Redux state between
+ * dispatches while still cancelling the previous request promptly.
+ */
+ if (prevController) {
+ setTimeout(() => prevController.abort(), 0);
+ }
Review Comment:
I had not included the set timeout but tests fail. Tests fail without the
setTimeout because abort() mutates the controller’s signal immediately, and
Redux flags that as a mutation during dispatch. The timeout defers that
mutation so Redux can complete the action.
--
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]