Giter Site home page Giter Site logo

Comments (9)

wesbos avatar wesbos commented on May 16, 2024 50

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:

  1. Each query has it's own cache:

allItems(limit:4, offset: 4)

  1. All items in a single cache, this removes the limit and cache variables from the query and we manage the field ourselves with a typePolicy.

Both have an issue. Let's say we add an item:

  1. With method 1, all the items need to be evicted or re-fetched

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

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

  4. 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 the allItems 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.

wesbos avatar wesbos commented on May 16, 2024 31

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.

Asjas avatar Asjas commented on May 16, 2024 4

Hey @RangerCoder99

Wes mentioned on Twitter that he chose Keystone 🙂

from advanced-react-rerecord.

esnakker avatar esnakker commented on May 16, 2024 2

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.

wesbos avatar wesbos commented on May 16, 2024 1

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.

adamtang79 avatar adamtang79 commented on May 16, 2024 1

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.

RangerCoder99 avatar RangerCoder99 commented on May 16, 2024

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.

gmwill934 avatar gmwill934 commented on May 16, 2024

How about using RQ?

from advanced-react-rerecord.

Asjas avatar Asjas commented on May 16, 2024

Wes is using Apollo Client 3 in this course 😃 @gmwill934

from advanced-react-rerecord.

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.