msyavuz commented on code in PR #36708:
URL: https://github.com/apache/superset/pull/36708#discussion_r2667728806


##########
superset-frontend/src/components/Chart/chartAction.js:
##########
@@ -590,9 +591,30 @@ export function refreshChart(chartKey, force, dashboardId) 
{
     ) {
       return;
     }
-    dispatch(
+
+    // Fetch the latest chart definition from the database to ensure we use
+    // the most recent configuration (e.g., if the chart was modified in 
another tab)
+    let formDataToUse = chart.latestQueryFormData;
+    try {
+      const queryParams = rison.encode({
+        columns: ['params'],
+      });
+      const response = await SupersetClient.get({
+        endpoint: `/api/v1/chart/${chart.id}?q=${queryParams}`,
+      });
+      formDataToUse = JSON.parse(response.json.result.params);

Review Comment:
   Can we check if the bot is right on this one?



##########
superset-frontend/src/explore/exploreUtils/index.js:
##########
@@ -20,6 +20,7 @@
 import { useCallback, useEffect } from 'react';
 /* eslint camelcase: 0 */
 import URI from 'urijs';
+import rison from 'rison';

Review Comment:
   Isn't the bot correct on this one? How is it not caught by the linter?



##########
superset-frontend/src/components/Chart/chartActions.test.js:
##########
@@ -502,4 +502,143 @@ describe('chart actions timeout', () => {
 
     expect(postSpy).toHaveBeenCalledWith(expectedPayload);
   });
+
+  // eslint-disable-next-line no-restricted-globals -- TODO: Migrate from 
describe blocks
+  describe('refreshChart', () => {

Review Comment:
   Let's not add more tech debt and use flattened structure for future tests 
(no describe)



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