Example of how to restore offline changes
See original GitHub issueStruggling with how to restore offline changes so that they reflect on the UI.
The following offline mutation saves the data to the offline store and reflects immediately on the UI - however when I refresh the page the changes are no longer reflected.
const [ updateTodo ] = useOfflineMutation(gql`
mutation UpdateTodo ($id: ID! $name: String!)
updateTodo (id: $id name: $id) {
id
name
}
}
`)
await updateTodo({
variables: { id: item.id, name: item.name },
returnType: 'Todo',
operationType: CacheOperation.REFRESH,
idField: 'id'
})
I’ve read through the docs and came across mutationCacheUpdates which looks as if it’s designed to do the trick but I can’t work out for the life of me how to use it - any pointers/examples would be much appreciated - cheers!
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (9 by maintainers)
Top Results From Across the Web
How to restore changes that were made offline in ...
Open a document, spreadsheet, presentation, or drawing. · Click the File menu and select See revision history. · Click a time stamp in...
Read more >Restore a past version in Google Docs - YouTube
Restore a past version in Google Docs. ... Top 5 Excel Functions for Finance People (with end-to-end example ). Chandoo. Chandoo.
Read more >Google Docs How to Recover an Erased Paper or Work
Best data recovery software : https://bit.ly/3IxCapK50% off now : https://bit.ly/3rLcoZpWas the video helpful? Want to return the favor.
Read more >Top 6 Ways to Fix Google Drive Offline Not Working Issue
1. Open Google Chrome. · 2. Click the Advanced button to expand the Settings tab and then scroll down to the Restore settings...
Read more >3 Ways to Turn On Offline Sync Google Drive/Google Docs
This article covers the full explanation of offline sync Google Drive and provides ... It does so by Saving the changes on your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Most of the queries from client are not named to reduce payload size. Named query/mutation can contain multiple underlying graphql queries and mutations. That is the reason we require actual query name in global cache updates. In terms of our underlying engine each operation is processed separately by conflict/offline engine anyway.
I guess we need to document good patterns to not name your queries if single operation is send etc. Also once we integrate offix with graphback we can enforce some standards or even generate cache update functions as they would be easy to build - then our helpers could be deprecated
Have you tried the following?