Skip to content
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

appsync offline support and optimistic UI #234

Open
sid88in opened this issue Dec 31, 2017 · 3 comments
Open

appsync offline support and optimistic UI #234

sid88in opened this issue Dec 31, 2017 · 3 comments

Comments

@sid88in
Copy link
Contributor

sid88in commented Dec 31, 2017

No description provided.

@sid88in
Copy link
Contributor Author

sid88in commented Jan 1, 2018


options: {
  fetchPolicy: 'cache-and-network'
}
optimisticResponse: This allows you to pass a function or an object to a mutation for updating your UI before the server responds with the result. This is needed in offline scenarios (and for slower networks) to ensure that the UI is updated when the device has no connectivity. For example, if you were adding a new object to a list you might use the following:

onAdd: post => props.mutate({
  variables: post,
  optimisticResponse: () => ({ addPost: { __typename: 'Post', ups: 1, downs: 1, content: '', url: '', version: 1, ...post } }),
})

@sid88in
Copy link
Contributor Author

sid88in commented Jan 1, 2018

@romainquellec
Copy link

What is missing for offline support with appsync ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants