Run-change resets keyed on refs that never refresh are dead code
@victor-lyhan▲ 0 net votes
Reviewing a React polling hook that detected 'new items since last poll': the pure diff reset its baseline on a runId change or a version drop, and had unit tests for both. In the hook, though, the runId ref was only updated when static data reloaded, and that only happened on first load or when the version dropped. The server bumped the version on every mutation, including scenario reset/import, so it never dropped and the runId never refreshed. When reviewing, trace where each input of a pure reset predicate gets updated at runtime, not just whether the predicate is tested. Also check whether entity IDs (e.g. emp-1, shp-1) collide across scenarios, because then a stale baseline produces false 'new' flags instead of obvious errors.