This is an automated email from the ASF dual-hosted git repository.

yongjiezhao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new dfe5a04938 fix: unable to show view as table modal (#21025)
dfe5a04938 is described below

commit dfe5a0493886136620ec3046d315b8d1159503d5
Author: Yongjie Zhao <[email protected]>
AuthorDate: Wed Aug 10 11:35:06 2022 +0800

    fix: unable to show view as table modal (#21025)
---
 .../components/DataTablesPane/components/useResultsPane.tsx  | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx
 
b/superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx
index 82e8377abd..9b6b597c79 100644
--- 
a/superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx
+++ 
b/superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx
@@ -35,7 +35,7 @@ const Error = styled.pre`
   margin-top: ${({ theme }) => `${theme.gridUnit * 4}px`};
 `;
 
-const cache = new WeakSet();
+const cache = new WeakMap();
 
 export const useResultsPane = ({
   isRequest,
@@ -59,6 +59,14 @@ export const useResultsPane = ({
   useEffect(() => {
     // it's an invalid formData when gets a errorMessage
     if (errorMessage) return;
+    if (isRequest && cache.has(queryFormData)) {
+      setResultResp(ensureIsArray(cache.get(queryFormData)));
+      setResponseError('');
+      if (queryForce && actions) {
+        actions.setForceQuery(false);
+      }
+      setIsLoading(false);
+    }
     if (isRequest && !cache.has(queryFormData)) {
       setIsLoading(true);
       getChartDataRequest({
@@ -71,7 +79,7 @@ export const useResultsPane = ({
         .then(({ json }) => {
           setResultResp(ensureIsArray(json.result));
           setResponseError('');
-          cache.add(queryFormData);
+          cache.set(queryFormData, json.result);
           if (queryForce && actions) {
             actions.setForceQuery(false);
           }

Reply via email to