Replies: 1 comment
-
I think at that point it would be the server's job to not create a new chat if one already exists - after all, the same race could occur if your friend and you start a chat at the same moment and there is no client-side way of preventing that. So maybe just have the server respond with a code 422 or something similar in that case? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a “Friends” sidebar in my app that creates a new “Chat” object everytime a user clicks on one of their friends. If the “Chat” already exists then it doesn’t create a new one. The ID of the chat is
<userID1>-<userID2>
.I’m running into an issue when the user clicks their friend, then clicks another friend then quickly goes back to the first friend before the chat creation mutation is complete, it will create a duplicate “Chat” for friend #1.
Does anyone know how to handle this sort of problem with RTK query?
Beta Was this translation helpful? Give feedback.
All reactions