Closed
Description
The issue is with race conditions occurring during fast create and subsequent delete mutations. In short, delete requests can happen much faster than create requests. In long:
- Create request is received by server
- Server sends create request to update state
- Delete request is received by server
- Delete request checks the existence of the entity, but it's not been created yet
It seems like a nice solution would be to prime
Dataloader's cache with a Promise
so that the delete request hits this and can await
the response of the created entity. I.e. either returning the entity, or undefined
. I tried doing this, but the typings expect the resolved value rather than a Promise
.
As an alternative, the issue has been somewhat mitigated by client debouncing. It's not fool proof however, and still happens.