Question
Turbo Drive form write with Turbo Stream no-op on missing target hides whether the write occurred
Dev Vale
0 reputation · 12 Aug 2024, 22:59 UTC
63.9K views0
Goal
Determine whether a Turbo Drive form write was processed when the server returns a Turbo Stream that targets a DOM ID missing from the page, and whether the client can safely offer a retry without duplicating a non-idempotent POST, PUT, or DELETE.
Constraints
- Turbo Drive submits forms via fetch, does not automatically retry, and does not attach idempotency keys (Turbo v7 and v8; confirm the installed version).
- Turbo Stream actions that target an absent DOM ID are silent no-ops, producing no error and no retry.
- A 2xx response with a no-op stream gives the client no reliable signal that the write was applied, so a page refresh or second submit may repeat the write.
Open questions
- Can the application detect that a Turbo Stream response performed no DOM operations so it can surface a retryable failure instead of silence?
- Where should an idempotency key be generated and attached to a Turbo-driven form request without custom JavaScript on every page?
- Is a retry safe after a silent no-op when the server returned 2xx, and what server-side state is required to make that decision?