You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
diagram: remove dead non-cloud branch and isCloud param from adjustFlows (Flow.tsx) #822
The private function adjustFlows(origStock, stock, flows, isCloud?) in src/diagram/drawing/Flow.tsx (defined at line 507) has two valve-fraction branches: an isCloud branch and a non-cloud (else) branch, selected by the optional isCloud?: boolean parameter (line 511).
The non-cloud branch and the isCloud parameter are unreachable dead code. adjustFlows has exactly one caller -- inside UpdateCloudAndFlow's straight-flow parallel-drag path in the same file:
That caller always passes isCloud=true, so the else branch (the general signed formula) never executes. An in-code NOTE already documents this (Flow.tsx:642-644).
Deferred cleanup
Remove the dead non-cloud branch and the isCloud parameter, inlining the cloud formula, since the sole caller always passes true. This is behavior-preserving:
The full diagram jest suite passes.
New characterization tests pin the isCloud valve output for centered / off-center / zero-delta drags.
Why it matters
Maintainability: the function currently carries two deliberately-different valve formulas plus a branch that can never run, which is a hazard for future edits (a reader can't tell which branch is live without tracing the single caller). Removing it shrinks the surface and eliminates a misleading general-purpose signature.
Identified during a behavior-preserving dedup pass on flow-editing code (branch flow-editing-hardening). The current PR's scope explicitly kept both branches and only documented their difference -- replacing an old // FIXME: reduce this duplication comment with a precise explanation of how the two formulas differ, plus the unreachable-branch NOTE. This cleanup is the deferred follow-up.
Activity