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


##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/keyValue.tsx:
##########
@@ -66,22 +66,41 @@ export const createFilterKey = (
       return null;
     });
 
-export const getFilterValue = (dashId: string | number, key?: string | null) =>
+// Single attempt with no client-side retries, so an aborted request settles
+// immediately. Callers that need retries own them.
+const getOnce = (endpoint: string, signal?: AbortSignal) =>
   SupersetClient.get({
-    endpoint: assembleEndpoint(dashId, key),
-  })
+    endpoint,
+    signal,
+    fetchRetryOptions: { retries: 0 },

Review Comment:
   **Suggestion:** `getPermalinkValue` now uses this no-retry request, so a 
transient 502 is swallowed after one attempt and chat-applied filters are 
silently skipped.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely` ยท ๐Ÿท๏ธ `Api mismatch`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=9cc09f0ac84141aa92fb26c6cdd5161a&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=9cc09f0ac84141aa92fb26c6cdd5161a&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/keyValue.tsx
   **Line:** 75:75
   **Comment:**
        *Api Mismatch: `getPermalinkValue` now uses this no-retry request, so a 
transient 502 is swallowed after one attempt and chat-applied filters are 
silently skipped.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45928&comment_hash=01bccc91534ce8a0b6c427930cdc7175bb3bff1be19db7ee9c94880f5bd92ba8&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45928&comment_hash=01bccc91534ce8a0b6c427930cdc7175bb3bff1be19db7ee9c94880f5bd92ba8&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset-frontend/src/dashboard/containers/DashboardPage.tsx:
##########
@@ -353,9 +433,42 @@ export const DashboardPage: FC<PageProps> = ({ idOrSlug }: 
PageProps) => {
       }
       return null;
     }
-    if (id) getDataMaskApplied();
+    if (id && readyToRender) getDataMaskApplied();
+    return () => {
+      cancelled = true;
+      controller.abort();
+      retryController.current?.abort();
+    };
     // eslint-disable-next-line react-hooks/exhaustive-deps
-  }, [readyToRender]);
+  }, [readyToRender, id]);
+
+  const retrySharedState = useCallback(async () => {
+    const source = sharedStateSource.current;
+    if (!source) return;
+    retryController.current?.abort();
+    const controller = new AbortController();
+    retryController.current = controller;
+    setIsRetryingSharedState(true);
+    const result: SharedStateResult<unknown> = await fetchSharedState(
+      source,
+      controller.signal,
+    );
+    if (controller.signal.aborted) return;
+    setIsRetryingSharedState(false);
+    if (result.status !== 'ok') {
+      setSharedStateNotice(result.status === 'expired' ? 'expired' : 'failed');
+      return;
+    }
+    const mask =
+      source.kind === 'permalink'
+        ? (result.value as DashboardPermalinkValue)?.state?.dataMask
+        : (result.value as Record<string, DataMask> | null);

Review Comment:
   **Suggestion:** `retrySharedState` applies only `state.dataMask`, then 
clears the warning; permalink `activeTabs`, `chartStates`, and `anchor` remain 
unapplied after a successful retry.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes` ยท ๐Ÿท๏ธ `Incomplete 
implementation`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=4f2588009dab4c8e92778dc73576bac5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=4f2588009dab4c8e92778dc73576bac5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/dashboard/containers/DashboardPage.tsx
   **Line:** 462:465
   **Comment:**
        *Incomplete Implementation: `retrySharedState` applies only 
`state.dataMask`, then clears the warning; permalink `activeTabs`, 
`chartStates`, and `anchor` remain unapplied after a successful retry.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45928&comment_hash=5fbd611c4fd55473e75d4bcb71e3e3b69d86883a53573947bf5786ad4fe7c03d&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45928&comment_hash=5fbd611c4fd55473e75d4bcb71e3e3b69d86883a53573947bf5786ad4fe7c03d&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset-frontend/src/dashboard/containers/DashboardPage.tsx:
##########
@@ -353,9 +433,42 @@ export const DashboardPage: FC<PageProps> = ({ idOrSlug }: 
PageProps) => {
       }
       return null;
     }
-    if (id) getDataMaskApplied();
+    if (id && readyToRender) getDataMaskApplied();
+    return () => {
+      cancelled = true;
+      controller.abort();
+      retryController.current?.abort();
+    };
     // eslint-disable-next-line react-hooks/exhaustive-deps
-  }, [readyToRender]);
+  }, [readyToRender, id]);
+
+  const retrySharedState = useCallback(async () => {
+    const source = sharedStateSource.current;
+    if (!source) return;
+    retryController.current?.abort();
+    const controller = new AbortController();
+    retryController.current = controller;
+    setIsRetryingSharedState(true);
+    const result: SharedStateResult<unknown> = await fetchSharedState(
+      source,
+      controller.signal,
+    );
+    if (controller.signal.aborted) return;

Review Comment:
   **Suggestion:** If dashboard navigation aborts a pending retry, this return 
skips resetting `isRetryingSharedState`; a later failure banner can leave Try 
again permanently loading.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely` ยท ๐Ÿท๏ธ `Logic error`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=a409021895ba4054880539cb76d337a5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=a409021895ba4054880539cb76d337a5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/dashboard/containers/DashboardPage.tsx
   **Line:** 456:456
   **Comment:**
        *Logic Error: If dashboard navigation aborts a pending retry, this 
return skips resetting `isRetryingSharedState`; a later failure banner can 
leave Try again permanently loading.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45928&comment_hash=f08aed003fefb463a5e298f304db15bc3bfca17bce103c9af6bc63e6d0d18748&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45928&comment_hash=f08aed003fefb463a5e298f304db15bc3bfca17bce103c9af6bc63e6d0d18748&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx:
##########
@@ -127,8 +133,10 @@ const publishDataMask = debounce(
     const nativeFiltersCacheKey = getUrlParam(URL_PARAMS.nativeFiltersKey);
     const dataMask = JSON.stringify(dataMaskSelected);
 
+    const forceNewKey = consumeNeedsNewKey();

Review Comment:
   **Suggestion:** After this flag is consumed, another debounced publish can 
run before key creation finishes, see the original URL key, and overwrite the 
shared state.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Rarely` ยท ๐Ÿท๏ธ `Race condition`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=af35d860807b4ea49ae72e83b3097d29&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=af35d860807b4ea49ae72e83b3097d29&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent ๐Ÿค– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx
   **Line:** 136:136
   **Comment:**
        *Race Condition: After this flag is consumed, another debounced publish 
can run before key creation finishes, see the original URL key, and overwrite 
the shared state.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45928&comment_hash=d64de33b1e29544029989cfade99707a428c244fd2c6aabe6aae62cb76fcc71d&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45928&comment_hash=d64de33b1e29544029989cfade99707a428c244fd2c6aabe6aae62cb76fcc71d&reaction=dislike'>๐Ÿ‘Ž</a>



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

  • [PR] fix(da... eschutho (via GitHub) via notifications
    • Re: [P... codecov[bot] (via GitHub) via notifications
    • Re: [P... netlify[bot] (via GitHub) via notifications
    • Re: [P... codeant-ai-for-open-source[bot] (via GitHub) via notifications
    • Re: [P... codeant-ai-for-open-source[bot] (via GitHub) via notifications
    • Re: [P... codeant-ai-for-open-source[bot] (via GitHub) via notifications
    • Re: [P... dpgaspar (via GitHub) via notifications
    • Re: [P... fitzee (via GitHub) via notifications
    • Re: [P... codeant-ai-for-open-source[bot] (via GitHub) via notifications
    • Re: [P... codeant-ai-for-open-source[bot] (via GitHub) via notifications
    • Re: [P... msyavuz (via GitHub) via notifications

Reply via email to