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


##########
superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.tsx:
##########
@@ -108,6 +111,19 @@ export default function DrillDetailModal({
     findPermission('can_explore', 'Superset', state.user?.roles),
   );
 
+  // Unlike DrillByModal, this component stays mounted for the lifetime of the
+  // chart and is toggled via `showModal`, so the event is gated on the modal
+  // actually being opened rather than firing on mount.
+  useEffect(() => {
+    if (showModal) {
+      dispatch(
+        logEvent(LOG_ACTIONS_DRILL_TO_DETAIL_MODAL_OPENED, {
+          slice_id: chartId,
+        }),
+      );
+    }
+  }, [dispatch, showModal, chartId]);

Review Comment:
   **Suggestion:** Because `chartId` is an effect dependency, changing the 
chart identity while the persistent modal remains open reruns this effect and 
records another “opened” event without a new open transition. Track the 
previous `showModal` value and log only when it changes from false to true, 
while using the current chart ID for that transition. [stale reference]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Duplicate Drill to Detail analytics rows can be recorded.
   - ⚠️ Chart-level modal-open metrics may overcount user openings.
   - ⚠️ Dashboard logging becomes inaccurate when chart identity changes 
in-place.
   ```
   </details>
   
   [![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=68825f6b161f48b7bf4934ac7388b58e&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=68825f6b161f48b7bf4934ac7388b58e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <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/DrillDetail/DrillDetailModal.tsx
   **Line:** 117:125
   **Comment:**
        *Stale Reference: Because `chartId` is an effect dependency, changing 
the chart identity while the persistent modal remains open reruns this effect 
and records another “opened” event without a new open transition. Track the 
previous `showModal` value and log only when it changes from false to true, 
while using the current chart ID for that transition.
   
   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%2F42563&comment_hash=f2f6944b951f01796bf3a3cdded00a1253e1f8ed08814889772925a8f4496756&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42563&comment_hash=f2f6944b951f01796bf3a3cdded00a1253e1f8ed08814889772925a8f4496756&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