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


##########
superset-frontend/src/dashboard/actions/dashboardLayout.ts:
##########
@@ -312,7 +312,7 @@ export function handleComponentDrop(dropResult: DropResult) 
{
       source &&
       !(
         // ensure it has moved
-        (destination.id === source.id && destination.index === source.index)
+        destination.id === source.id && destination.index === source.index
       )
     ) {

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Operator Precedence Breaks Move Guard</b></div>
   <div id="fix">
   
   Removing the parentheses changes operator precedence. `!` binds tighter than 
`&&`, so the new expression parses as `(!destination.id === source.id) && 
destination.index === source.index`. The sub-expression `!destination.id === 
source.id` compares a boolean to a string and is always `false`, so 
`moveComponent` will essentially never be dispatched, breaking dashboard 
drag-and-drop. The existing test `should move a component if the component is 
not new` in `dashboardLayout.test.ts` would fail. Restore the parentheses 
around the inner AND.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
          source &&
          !(
            // ensure it has moved
            (destination.id === source.id && destination.index === source.index)
          )
        ) {
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #8e90d5</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