GithubHelp home page GithubHelp logo

Comments (4)

jbaxleyiii avatar jbaxleyiii commented on April 27, 2024

➤ Kenneth Bambridge commented:

Do you have to update the store? The store is meant to be a cache of back end data. Perhaps you can map data from the store into the final version you will show in your UI?

from apollo-link-state.

jbaxleyiii avatar jbaxleyiii commented on April 27, 2024

➤ falconmick commented:

To simplify, 1st query causes another query to have to be run. Right now that means the front end has to spend 2x as long purely on ping from server to client. When I run the 1st query, as soon as it gets to the resolver of the type I can figure out all the extra data I need and add it to what ever the query returns. The issue is that I cannot use update from within a query to manually fix the cache whereas if it were a mutation theoretically I could (theoretically as I’ve never used update before, just read doco)

Does that help?

Cheers

from apollo-link-state.

jbaxleyiii avatar jbaxleyiii commented on April 27, 2024

➤ Kenneth Bambridge commented:

Hm what about storing that data separately in the redux store? If you have a unique id for each object in the store then you could store that data separately and combine it in your components.

from apollo-link-state.

jbaxleyiii avatar jbaxleyiii commented on April 27, 2024

➤ falconmick commented:

I could, but then I cannot utilise one of apollo’s Key gains which is it’s basically magic automatic cache. I would then need to intercept queries before I send em and parse them looking for any in my cache...

And if I just resolve the data that was prefetched for the sub components to my components I could still get the benefits of the cache for that query, but if the data returned were to be a part of a direct query (not sub query like from a page) I would have to fetch it as it’s not in apollo cache. Not to mention the queries attached to my component would need to be somehow told to not fetch as I have already passed em to the component.

However it is definitely an option, if using mutations is either too messy OR not viable I’ll give it a go. Also once I upgrade to 2.0 I’ll have a go at adding update to queries and maybe make a PR

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.