marunrun commented on code in PR #35208:
URL: https://github.com/apache/superset/pull/35208#discussion_r3472619059
##########
superset-frontend/src/explore/components/controls/ViewQueryModal.tsx:
##########
@@ -48,38 +50,42 @@ const ViewQueryModalContainer = styled.div`
gap: ${({ theme }) => theme.sizeUnit * 4}px;
`;
-const ViewQueryModal: FC<Props> = ({ latestQueryFormData }) => {
+const ViewQueryModal: FC<Props> = ({ latestQueryFormData, ownState }) => {
const [result, setResult] = useState<Result[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
- const loadChartData = (resultType: string) => {
- setIsLoading(true);
- getChartDataRequest({
- formData: latestQueryFormData,
- resultFormat: 'json',
- resultType,
- })
- .then(({ json }) => {
- setResult(ensureIsArray(json.result) as Result[]);
- setIsLoading(false);
- setError(null);
+ const loadChartData = useCallback(
+ (resultType: string) => {
+ setIsLoading(true);
+ getChartDataRequest({
+ formData: latestQueryFormData,
+ resultFormat: 'json',
+ resultType,
+ ownState: ownState || {},
})
- .catch(response => {
- getClientErrorObject(response).then(({ error, message }) => {
- setError(
- error ||
- message ||
- response.statusText ||
- t('Sorry, An error occurred'),
- );
+ .then(({ json }) => {
+ setResult(ensureIsArray(json.result) as Result[]);
setIsLoading(false);
+ setError(null);
Review Comment:
Agreed this is a real concern in principle, but I'm intentionally leaving it
out of this PR. The lack of request cancellation/sequencing is a pre-existing
property of `getChartDataRequest` → `SupersetClient.post` (no abort support)
and of `ViewQueryModal` before this PR — it isn't introduced by these changes.
Adding proper AbortController or sequence-guard handling is a broader,
standalone improvement that should cover all `getChartDataRequest` call sites,
not just this modal. I'll file it as a separate issue so it gets the right
scope rather than being bolted onto a query-consistency bug fix.
--
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]