Comments (9)
Still waiting on the folks at Apollo, but they are working on a fix or a solution for us.
Just for reference the issue is this:
We have 4 items per page.
When I visit a page, those 4 items are slotted into the cache.
When you add or remove an item, that cache needs to be updated.
Now we can control the cache in two ways:
- Each query has it's own cache:
allItems(limit:4, offset: 4)
- All items in a single cache, this removes the
limit
andcache
variables from the query and we manage the field ourselves with a typePolicy.
Both have an issue. Let's say we add an item:
-
With method 1, all the items need to be evicted or re-fetched
-
There is currently no way to evict all items of a type. You can either delete 1 item from the cache, or blow the entire apollo cache away.
-
With refetching queries, I'd need to supply an array of queries that need to be re-fetvched. But when an item is added, we don't know how many queries are in the cache, how many pages there are, what the offsets are etc.... And we could possibly have hundreds of pages in the cache
-
With method 2, we can put all the items in one cache, so this means when we delete or add an item, we simply just add or remove it from the cache in the slot it needs. Great! This actually works well, BUT this means we have to use a type policy for
allItems
, and then we aren't able to use theallItems
query for anything else on the page. In our case we need it for search. So if I search for "shoes", the cache is now filled with items that match the search query and all our pagination data is gone.
So that's where we are at right now... I'm very open to having approached this absolutely wrong because I can't believe I'm the only one with this issue, but from talking to @kkemple it seems we are doing it right!
So that is where we are at! Huge thanks for the apollo folks for helping with this.
Once this is finished we are GOOD TO GOOOOOO
from advanced-react-rerecord.
thanks @Asjas!
Yes I'm just going ahead with the recording. The folks at apollo have been super helpful but I can't wait any more. There might be bugs in the pagination which can be remedied with a video update if they ever find a solution.
Recording is happening right now!
from advanced-react-rerecord.
Hey @RangerCoder99
Wes mentioned on Twitter that he chose Keystone 🙂
from advanced-react-rerecord.
Oh and Keystone vs Strapi:
they are very very close, Strapi has a better UI IMO, keystone has a bit better access control. also keystone is being re-written in Next.js (will be included in the course), so customizing the backend will be super easy.
Have been playing around with Strapi since the beta and I must say: I really love it! It's super flexible and the access control is also very granular (per role and for any single content type) you have a media library that can be linked with an S3 bucket and I also really like the Component feature (formerly dropzones). They enable you to build flexible layout from the backend (like gutenberg in WP).
Would be absolutely great to watch a course were you are using it for the backend. Strapi is also very high in demand by many (ongoing) webdevelopers. I thing it will be a big think in 2021.
from advanced-react-rerecord.
Oh and Keystone vs Strapi:
they are very very close, Strapi has a better UI IMO, keystone has a bit better access control. also keystone is being re-written in Next.js (will be included in the course), so customizing the backend will be super easy.
from advanced-react-rerecord.
Hi @wesbos , i'm tired of rest and trying graphql after some recommendation. Initially I was from ws then grpc. I've got the feeling that graphql are just another type of nosql. Can I do short call as well as long call? eg. I had used loopback rest to call a function to process things up to 6 hours. I think method 1 to blow the whole cache is acceptable, of course, smart invalidation will be nice to have. When are your new recordings released in your planning? And by the way, I need mysql and mongodb for daily programming. And also wish i can easy startup somekind of backend to serve frontend (creative-tim, themeforest's react template, or next template). Doing frontend is tiring...
from advanced-react-rerecord.
Hope there is a process on this issue, Also did you pick one backend to use yet? Like you still seem to be going between keystone and Strapi.
from advanced-react-rerecord.
How about using RQ?
from advanced-react-rerecord.
Wes is using Apollo Client 3 in this course 😃 @gmwill934
from advanced-react-rerecord.
Related Issues (20)
- Dummy Data HOT 1
- Update Edit UI HOT 1
- Apollo 3 isn't launched yet HOT 28
- Update Cache and pagination logic when you add an item HOT 1
- Deploy two separate apps (frontend and backend) HOT 1
- Custom _document.js to be written with React hooks HOT 1
- Update Next.js to 9.3 HOT 1
- Any plan to upgrade to prisma 2.0? HOT 1
- Replace getInitialProps with getStaticProps or getServerSideProps HOT 2
- Recording in Keystone.js 5 or Prisma 2? HOT 3
- Calculation for resetPassword might be off? HOT 3
- Use next.js Api or stick with GraphQL Yoga HOT 5
- search doesnt work HOT 1
- Edit needs to work
- update query() to executeQuery
- Hi Wes, any idea how long until the rerecord will be released? HOT 5
- 2020 is over... Any Update HOT 1
- Need to pass resolveFields to lists.Product.findOne to return product.name HOT 1
- Unhandled Runtime Error Error: useKeystone must be called inside a KeystoneProvider component HOT 3
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 advanced-react-rerecord.