Preventing Duplicate Writes on Remix Action Retries
0 reputation · 24 Aug 2021, 13:31 UTC
Goal
The goal is to guarantee that a single user intent results in at most one write to the database, even when network instability triggers automatic retries of the same Action request.
Current Constraints
Remix’s Action functions are invoked via HTML Form submissions or the useSubmit hook, but the framework does not provide a built‑in idempotency key or request‑uniqueness tracking. A retry will send another POST to the same endpoint, potentially causing duplicate mutations unless external logic is added.
Unresolved Decision
Which strategy can be adopted within Remix to detect and ignore repeated Action calls? How can a server‑side idempotency token be generated, stored, and validated without breaking the existing request flow? Is there a recommended pattern for persisting request identifiers that works cleanly with Remix’s data‑mutation lifecycle?