Comments (4)
➤ 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.
➤ 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.
➤ 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.
➤ 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)
- 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.