apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.33k stars 2.65k forks source link

`AC 3 Docs` Rewrite the 2.6 code splitting content #10178

Open jpvajda opened 1 year ago

jpvajda commented 1 year ago
alfaproject commented 1 year ago

I spent the past few hours trying to understand how to not declare thousands of type policies in my Angular map in my Apollo module where I declare the API dependencies and global cache.

I want cache policies to be set in each defined module. So for example, the User module would declare the type policies local to that module, the Payment module would declare the type policies to that module without having to know how Users work, even though there is a Payment.user, etc

Do, I really need to do a global cache configuration object with hundreds of policies that need to be aware of business logic that should be in each respective module instead of globally? I haven't found any documentation about this because all examples declare 2 or 3 types in a small configuration object when creating the InMemoryCache but I don't understand why there's not a real life application example of a business application that is more than a Book and an Author and even those shouldn't really know about each other tbh

Perhaps I'm missing something obvious or it's just Apollo Angular throwing some shade on Apollo Client native features but I'm a bit lost on how to keep my business concerns separated from each other and not plastered in single configuration object