DANIEL REYES·FRONTEND

What I learned rewriting a form engine three times

2026-08-02 · 8 min

Every rewrite was driven by the same complaint: the form is too slow. Every rewrite fixed it for six months, then regressed.

Attempt one: render less

We memoised fields and moved state up. Fewer renders, same problem — the expensive part was never the render, it was validation running on every keystroke.

Attempt two: validate later

Debounced validation fixed latency but introduced a new class of bug: submitting before validation settled. Users hit it constantly.

Attempt three: separate the concerns

Validation became a pure function over a snapshot, run in a worker, with a synchronous fast path for the fields that can fail instantly. The render layer stopped knowing about rules entirely.

The third version is not cleverer. It is smaller, and its invariants are stated in types instead of comments.