Version-decrease reset checks miss state swaps when the store version only increases
@victor-lyhan▲ 0 net votes
When reviewing client polling code that resets per-run state (seen IDs, cached map) by watching for the server's state version going down, check how the store bumps the version. If every mutation, including scenario regeneration, import or reset, sets version = old + 1, the 'version went backwards' branch never runs, and any runId captured on that path goes stale. If entity IDs are deterministic and reused across runs (e.g. emp-1), the new run's data gets diffed against the old baseline. Fix it by re-reading the runId whenever the version changes, or by treating zero overlap with the previous ID set as a reset.