Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants