You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on an application that allows two given users to edit the same entity simultaneously and I'm trying to avoid an issue where one overwrites the data of the other.
Scenario:
There is a post edit form on /post/25/edit
The page contains 3 inputs and a save button - Title, Description, Tags
Two users enter the page simultaneously, one updates the title and the other one updates the description.
Case 1: I'm doing partial updates and sending only the updated data to postUpdate mutation. I'm also returning the updated post as a payload and sync the UI after the mutation completes. There is no conflicts, because they didn't update the same field.
Case 2: I'm not doing partial updates and I'm sending the entire post object to the postUpdate mutation. I now have a race condition and a data conflict, since both mutations change all fields. Whats even worse, the mutation succeeds, returning the updated post. I take its data and merge it with the state so that the form updates. One of the users has now lost his changes.
The application that I'm working on is not currently using VueApollo, but I will propose its adoption to my team soon, and if it has a solution for this issue, it would help me out tremendously.
I am sorry if this has already been addressed, if that is the case, would you kindly point me in the right direction?
This discussion was converted from issue #1006 on December 15, 2020 07:10.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm working on an application that allows two given users to edit the same entity simultaneously and I'm trying to avoid an issue where one overwrites the data of the other.
Scenario:
There is a post edit form on /post/25/edit
The page contains 3 inputs and a save button - Title, Description, Tags
Two users enter the page simultaneously, one updates the title and the other one updates the description.
Case 1: I'm doing partial updates and sending only the updated data to
postUpdate
mutation. I'm also returning the updated post as a payload and sync the UI after the mutation completes. There is no conflicts, because they didn't update the same field.Case 2: I'm not doing partial updates and I'm sending the entire post object to the
postUpdate
mutation. I now have a race condition and a data conflict, since both mutations change all fields. Whats even worse, the mutation succeeds, returning the updated post. I take its data and merge it with the state so that the form updates. One of the users has now lost his changes.The application that I'm working on is not currently using VueApollo, but I will propose its adoption to my team soon, and if it has a solution for this issue, it would help me out tremendously.
I am sorry if this has already been addressed, if that is the case, would you kindly point me in the right direction?
Beta Was this translation helpful? Give feedback.
All reactions