aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.82k stars 820 forks source link

some problems about GraphQL And DataStore CRUD operations #7342

Closed sina-developer closed 3 years ago

sina-developer commented 3 years ago

Note: If your question is regarding the AWS Amplify Console service, please log it in the AWS Amplify Console repository

Which Category is your question related to?

GraphQL Api

Amplify CLI Version

You can use amplify -v to check the amplify cli version on your system

4.50.2

What AWS Services are you utilizing?

Auth,Api,Function,Storage

Question :

I have a question about graphql queries on react js app

when i was using AppSync to test some data, i just noticed there is a column called _version which is related to Conflict Resolution on the react side i'm using API.graphQL funciton to CRUD operations but that _version column makes things harder so : 1- can i turn off this Conflict Resolution? 2- how should handle this versioning stuff? 3- should i only use AppSync for Managing Data ? 4- when i remove data using API.graphQL it is still there! what should i do? also i tried DataStore too and that is offline first library but in my application i need to be fully online i dont want to save data temporarily on client-side and then upload when it gets online also there is no way to log the result to detect that a record has been saved locally or online!

so Datastore questions: 1- how should i get the result log of an operation? 2- how to turn off offline-first ability?

SwaySway commented 3 years ago

Hello @sina-developer Conflict Resolution is a AppSync Feature which is used as a part of DataStore. For info on what the fields (such as _version) mean refer to the AppSync dos below. You can check if you have this enabled if there is a ResolverConfig in your transform.conf.json. If you have this enabled it is best to use the DataStore library as the deleting a field will leave it with a timestamp when the said record will expire. (mentioned in the appsync docs). If you would not like to use datastore you can disable it when running amplify update api.

If you have any issues/questions using DataStore from the library. I'd recommend opening a question/discussion thread with the amplify library you are using.

AppSync Conflict Resolution Docs: https://docs.aws.amazon.com/appsync/latest/devguide/conflict-detection-and-sync.html

sina-developer commented 3 years ago

thank you for your response

amplify update api worked!

github-actions[bot] commented 3 years ago

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 *-help channels for those types of questions.