codeant-ai-for-open-source[bot] commented on code in PR #45541:
URL: https://github.com/apache/superset/pull/45541#discussion_r4341208505


##########
superset-frontend/src/components/Chart/ChartRenderer.tsx:
##########
@@ -282,25 +304,34 @@ function ChartRendererComponent({
   const chartEnableNoResults =
     getChartMetadataRegistry().get(vizType)?.enableNoResults ?? true;
 
-  // A failed load leaves its errored response in the store, and the next
-  // CHART_UPDATE_STARTED clears chartAlert but not queriesResponse. Checking
-  // the response itself keeps that stale error from being drawn as chart data
-  // while the retry is in flight.
-  const hasAnyErrors = queriesResponse?.some(item => item?.error);
-  // The response of a chart that fetches its own data stays empty once it has
-  // loaded, so for those any response that landed counts as previous data.
-  const hasPreviousResponse = chartEnableNoResults
-    ? (queriesResponse?.length ?? 0) > 0
-    : Array.isArray(queriesResponse);
-  const hasValidPreviousData = hasPreviousResponse && !hasAnyErrors;
-
-  // An auto-refresh keeps the chart on screen while its query is in flight.
-  // The store holds the previous response until the new one lands, so that
-  // response is what the chart renders in the meantime.
+  // A dashboard keeps the chart on screen while its query is in flight, be it
+  // an auto-refresh, a manual refresh or a filter change. The store holds the
+  // previous response until the new one lands, so that response is what the
+  // chart renders in the meantime.
   const isRefreshing =
-    Boolean(restProps.suppressLoadingSpinner) && chartStatus === 'loading';
+    chartStatus === 'loading' &&
+    (Boolean(restProps.suppressLoadingSpinner) ||
+      source === ChartSource.Dashboard);
   const hasRenderableResults =
-    resultsReady || (isRefreshing && hasValidPreviousData);
+    resultsReady ||
+    (isRefreshing && hasValidPreviousData(queriesResponse, vizType));
+
+  // The form data each response was queried with. A filter change updates
+  // formData as soon as the new query starts, so the previous response is
+  // drawn with its own form data until the new one lands.
+  const responseFormDataRef = useRef({
+    queriesResponse,
+    formData: currentFormData,
+  });

Review Comment:
   ✅ **CodeAnt verified this suggestion was addressed in subsequent commits and 
marked this thread resolved** as of `9f79348`.
   
   While refreshing, `renderedFormData` now uses `responseFormData` alongside 
the retained query response; otherwise it uses `currentFormData`.
   
   <sub>If that's not right, unresolve this thread and CodeAnt will leave it 
open.</sub>
   
   <!-- codeant-auto-resolve-reply -->



-- 
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]

Reply via email to