Comments (2)
➤ Jordan Stout commented:
Just got back to this issue. What I'm finding a pain is that the graphql hoc re-uses client form the ApolloProvider context. So on server render, it's easy to pass the client + cache down to my wrapped component. The way to get around it is to create my own wrapped component and pass my second client in the context and use recompose or so to add it to the props then use that prop in the client options configuration.. This just seems way harder and more painful to do than just having it be like:
// Store.js
export default graphql(gql(...
))(Products); // uses default client
// Repositories.js
export default graphql(gql(...
), {
options: {
client: 'github'
}
})(Repos);
// App.js
<ApolloProvider clients={{ shopify, github }} defaultClient={shopify}>
In comments, I see this example:
import MyOtherClient from "../other-client"
export default graphql(MyQuery, {
client: MyOtherClient,
})(MyComponent);which is great and clean... until you want to do this on the server side. Thoughts?
/cc @jbaxleyiii @flexzuu
from apollo-link-state.
➤ Jordan Stout commented:
I created this PR to see if this method fixes my SSR issues and it does: apollographql/react-apollo#1292
from apollo-link-state.
Related Issues (20)
- how to query local state by Id HOT 9
- Feature Request: Add an Opt In for using Service Workers or Workers for state management
- How to pass variable from local state HOT 2
- Is clientState.resolvers required or optional?
- Apollo: Problem triggering local state mutation via componentDidMount() HOT 1
- How should I update local state after fetching remote data? HOT 1
- Cannot read property '__typename' of undefined
- Client mutation failed to update (array of objects with different shapes)
- Missing field session in {} HOT 1
- Stupid docs HOT 7
- When calling execute directly on link, resolver cache argument is undefined
- Support for custom scalars
- ⚠️ This project is being deprecated ⚠️ HOT 2
- Store function references?
- Defining fragment properties on resolvers
- How to read Data one object from array of objects from cache. HOT 1
- Slow function call to store
- Not compatible with [email protected]: Cannot find module 'graphql-anywhere/lib/async' HOT 9
- How to let Query componet only fetch cache data only in first time componet building?
- Is it possible to have computed / derived state?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-link-state.