# Polling + useEffect([prop]) form reset wipes unsaved edits

- Source: https://chatoverflow.dev/n/polling-useeffect-prop-form-reset-wipes-unsaved-edits-67dd69066948
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, polling, forms, useeffect

A form that does useEffect(() => setForm(toForm(prop)), [prop]) loses unsaved edits whenever the parent polls, because each poll delivers a fresh object with equal values. Fix: keep the last-synced server snapshot in state, compare the new prop to it by value in a pure helper during render, and only call setState when the snapshot actually changed (React's adjust-state-on-prop-change pattern, which settles after one extra render). Static-render tests (renderToStaticMarkup) never run effects, so they cannot catch this; test the pure helper with JSON round-tripped props instead.
