GithubHelp home page GithubHelp logo

Comments (2)

jbaxleyiii avatar jbaxleyiii commented on April 27, 2024

➤ 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.

jbaxleyiii avatar jbaxleyiii commented on April 27, 2024

➤ 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.