-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show partial data from list view in details
Since we already have most of the information that we want to show for the character in the cache from the list query, then we can improve the user experience by showing most of that data to the user while the rest are still loading. There are two main pieces of the puzzle for this: 1. [`returnPartialData` option for `useQuery`](https://www.apollographql.com/docs/react/data/queries/#returnpartialdata), which lets Apollo Client return a partial response from the cache, if we have *anything* there already. 2. The `read` function for `character` query `typePolicies` allows us to return an existing object from the cache if we already have something saved there (e.g., a Character with the correct ID, but under a different query).
- Loading branch information
1 parent
09ad51b
commit a3b3aac
Showing
2 changed files
with
58 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters