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


##########
superset-frontend/src/components/Chart/ChartRenderer.tsx:
##########
@@ -381,9 +381,26 @@ function ChartRendererComponent({
 
   const setDataMaskCallback = useCallback(
     (dataMask: DataMask) => {
-      actions?.updateDataMask?.(chartId, dataMask);
+      const sourceForm = latestQueryFormData ?? formData;
+      actions?.updateDataMask?.(
+        chartId,
+        sourceForm.datasource?.endsWith('__semantic_view')
+          ? {
+              ...dataMask,
+              extraFormData: {
+                ...dataMask.extraFormData,
+                semantic_selection_sources: [
+                  {
+                    datasource: sourceForm.datasource,
+                    version: sourceForm.semantic_selection_version ?? null,
+                  },
+                ],

Review Comment:
   **Suggestion:** This replaces all existing semantic sources with one chart 
source, so valid provenance from multiple interactive or overlay selections is 
lost on any chart mask update.
   
   **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=043db7d67efd482facb46127246748c5&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=043db7d67efd482facb46127246748c5&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/components/Chart/ChartRenderer.tsx
   **Line:** 392:397
   **Comment:**
        *Incomplete Implementation: This replaces all existing semantic sources 
with one chart source, so valid provenance from multiple interactive or overlay 
selections is lost on any chart mask update.
   
   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%2F44370&comment_hash=adc3c5aaa946e16e9fc4ff7464453ecfb27fda62f5d4a892fa053c29f2e15ee0&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44370&comment_hash=adc3c5aaa946e16e9fc4ff7464453ecfb27fda62f5d4a892fa053c29f2e15ee0&reaction=dislike'>๐Ÿ‘Ž</a>



##########
superset-frontend/src/dataMask/reducer.ts:
##########
@@ -77,6 +77,16 @@ export interface HydrateDataMaskAction {
   };
 }
 
+function getRestoredSelectionEvidence(
+  mask: DataMask | undefined,
+  version: string | undefined,
+): Partial<DataMask> {
+  // A restored value must not inherit the default's identity evidence.
+  return version && mask?.filterState && !mask.extraFormData
+    ? { extraFormData: {} }

Review Comment:
   **Suggestion:** When a restored selection has no extra data, this replaces 
the default's entire `extraFormData`, also discarding unrelated default filters 
and pre-filter conditions.
   
   **Assessment:** ๐ŸŸ  `Major` ยท ๐Ÿ” `Occurrence: Sometimes` ยท ๐Ÿท๏ธ `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=4a25d619b5ed4517b4a8939b5a3f61d2&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=4a25d619b5ed4517b4a8939b5a3f61d2&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/dataMask/reducer.ts
   **Line:** 85:86
   **Comment:**
        *Logic Error: When a restored selection has no extra data, this 
replaces the default's entire `extraFormData`, also discarding unrelated 
default filters and pre-filter conditions.
   
   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%2F44370&comment_hash=64d054c9f3841b0441124ccfc65d11ea3b7ae88a3fd97741fe89407b6f9c4b9d&reaction=like'>๐Ÿ‘</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44370&comment_hash=64d054c9f3841b0441124ccfc65d11ea3b7ae88a3fd97741fe89407b6f9c4b9d&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]

Reply via email to