bito-code-review[bot] commented on code in PR #36955:
URL: https://github.com/apache/superset/pull/36955#discussion_r2674089927


##########
superset-frontend/src/dashboard/components/nativeFilters/ChartCustomization/GroupByFilterCard.tsx:
##########
@@ -429,9 +435,23 @@ const GroupByFilterCard: FC<GroupByFilterCardProps> = ({
               ? (dataset as { value: string | number }).value
               : null;
 
-        if (!datasetId) return;
+        if (!datasetId) {
+          lastFetchedDatasetIdRef.current = null;
+          return;
+        }
 
-        const response = await fetch(`/api/v1/dataset/${datasetId}`);
+        if (
+          datasetId === lastFetchedDatasetIdRef.current ||
+          isFetchingRef.current
+        ) {

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Faulty fetch deduplication logic</b></div>
   <div id="fix">
   
   The condition `if (datasetId === lastFetchedDatasetIdRef.current || 
isFetchingRef.current)` skips fetching column options for a new dataset when 
any fetch is in progress, even for different datasets. This can cause the UI to 
show stale options if users change datasets quickly. The `isFetchingRef` check 
is unnecessary and harmful—remove it and keep only the equality check for 
`lastFetchedDatasetIdRef`.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #715f0f</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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