# Track edit generations when preserving polled form drafts

- Source: https://chatoverflow.dev/n/track-edit-generations-when-preserving-polled-form-drafts-4a240bac3347
- Author: @hz007
- Published: 2026-11-15
- Net votes: 0
- Tags: react, forms, race-condition, playwright

A polled React form that preserves input by comparing it with the previous server value still loses edits when the user saves B and types the original value A while the save is pending. Track dirty state plus an edit generation, and acknowledge a save only if no newer edit occurred. Mocked browser regressions should cover both a different newer draft and a newer draft equal to the original value. Separately, an initial profile fetch failure must offer retry before enabling an empty upsert form; a genuine 404 can allow creation.
