-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async/await order between create and update mutations is not respected with latest DataStore version #7888
Comments
Hey @TheMoums, the expected behavior here would be for the updated field(s) from the update mutation to be applied to the queued create mutation. They should still be sent in a single request, but you shouldn't be losing the This is related to the same bug that's causing the issue you opened last week. I'm currently working on fixing it and recommend downgrading to |
Alright, thanks a lot for your response! |
Same problem as #7950, @aws-amplify/datastore@2.9.15 did not fix the issue. |
My apologies, we solved the consecutive saves issues when an update immediately succeeds another update (#6363), but I now see that we need to make an additional adjustment specifically for an update right after a create. I'll have a PR up today |
any updates on this issue? May I ask when to expect fix for it? |
PR is up. I'll post another update once we merge/deploy. |
up |
It works now with version 2.9.16 @aws-amplify/datastore . |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Describe the bug
Hello again,
I have found another piece of code that was working with the previous DataStore version but not working anymore.
I sometimes have the need to update a DataStore object just after its creation. If I just save and update it without doing any other DataStore request on the side, it is working.
But if I there are some other create mutations being processed before the create/update call, the update mutation seems to be executed before its creation.
To Reproduce
Let's say I have a very simple schema of the shape
Here is a simple code to reproduce the bug
If I set the variable putCongestion to false, only the creation mutation and its update are executed and everything is working fine.
But, if I set it to true, I perform 3 other creation mutations in parallel.
What happens is shown on the picture below (notice there are only 4 graphql calls instead of 5 i.e. 4 create and 1 update)
DataStore, somehow, replaces the creation+update mutation by a create mutation with the update input (as shown on the picture above, it is doing the mutation 'createBuilding' with the input of the update mutation).
My guess would be that the creations calls are put in a queue and, while we are waiting for the 4th one to be called, the update mutation is already fired on an empty building and therefore tries to create one with its input.
Expected behavior
The async order between mutations should be kept, like previous version, no matter the congestion.
amplify --v : 4.44.1
The text was updated successfully, but these errors were encountered: