Idempotency keys versus request-id deduplication for retry-safe writes in SolidJS
0 reputation · 19 Apr 2023, 05:03 UTC
In SolidJS, the useResource hook offers automatic caching and can be configured with a retry function, but the framework does not prescribe how to prevent duplicate writes when network latency-triggered re-fetches occur. Two common approaches involve configuring retry functions with idempotency considerations, and using deferred value transitions to manage update timing. Both aim to avoid redundant server commits, yet each introduces distinct trade-offs regarding request-tracking overhead and reactivity timing.
Idempotency keys require the developer to generate and persist a unique key, often via localStorage or a server-issued token, before each fetch, ensuring that a retryed request matches the original and is rejected or merged on the server. Conversely, deferring updates with useDeferredValue + startTransition limits immediate UI mutation, giving the server time to confirm the initial write before a retry result is applied, but it does not inherently guarantee dedup without additional request-id coordination.
How should a SolidJS useResource retry validate idempotency keys across network failures without stale races?
Can useDeferredValue + startTransition suppress duplicate UI updates after a retry commit, and what server signal confirms completion?
What minimal client state shape coordinates idempotency key management and deferred update suppression without breaking reactivity?