-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable local state only when client resolvers provided. (#4499)
* Enable local state only when client resolvers provided. If an application was previously using apollo-link-state, updating to apollo-client@2.5.0 could cause problems because @client fields are now stripped by the integrated LocalState API, and thus will not be passed into the link chain. This commit should ease the transition by enabling the LocalState functionality only if client resolvers were passed to the ApolloClient constructor, or the LocalState#setResolvers method has been called. If no client resolvers have been specified, @client fields will remain in the query passed to the link chain, so apollo-link-state can still process them, though a warning will be logged in development. If you want to use @client directives to read from or write to the cache without running resolver functions, you can pass an empty resolvers:{} map to enable the LocalState functionality (including the stripping of @client fields from queries). * Refine private LocalState resolvers field type. The setResolvers method normalizes Resolvers[] arrays into a combined (non-array) Resolvers object.
- Loading branch information
Showing
3 changed files
with
61 additions
and
6 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
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