Skip to content

Commit

Permalink
fix: unable to show view as table modal
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyongjie committed Aug 9, 2022
1 parent 03764e6 commit d1f1064
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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({
Expand All @@ -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);
}
Expand Down

0 comments on commit d1f1064

Please sign in to comment.