facebook/react

Bug: Redundant Operation in getEntangledLanes Function Doesn't Modify entangledLanes as Intended

Acabbage opened this issue · 0 comments

Description:

In the getEntangledLanes function, there appears to be a redundant operation inside the if statement that doesn't alter the value of entangledLanes as intended. This might be a bug or oversight in the implementation.

Code Snippet:

export function getEntangledLanes(root: FiberRoot, renderLanes: Lanes): Lanes {
  let entangledLanes = renderLanes;

  if ((entangledLanes & InputContinuousLane) !== NoLanes) {
    // When updates are sync by default, we entangle continuous priority updates
    // and default updates, so they render in the same batch. The only reason
    // they use separate lanes is because continuous updates should interrupt
    // transitions, but default updates should not.
    entangledLanes |= entangledLanes & DefaultLane;
  }

  // ... rest of the function ...
}

Problem Description:

In the if statement, the intention seems to be to entangle DefaultLane with InputContinuousLane when entangledLanes includes InputContinuousLane, so they render in the same batch. However, the operation:

entangledLanes |= entangledLanes & DefaultLane;

is effectively a no-op and doesn't change entangledLanes. This means that DefaultLane is not being properly entangled as intended.