kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 309 forks source link

Apollo Angular SSR use state transfer: not respect default cache policy `cache-first`, have to add manual on each request #1765

Open hiepxanh opened 2 years ago

hiepxanh commented 2 years ago

Describe the bug

As Apollo Client describe, it default policy is cache-first which is not really understand why not working on apollo angular universal if I use TransferState.

image

To Reproduce Steps to reproduce the behavior:

Expected behavior

Environment:

dependencies:
@angular/cli 13.1.2
@angular/core 13.2.1
@apollo/client 3.5.8
apollo-angular 3.0.0
graphql 15.8.0
typescript 4.5.4

Additional context

I'm willing to check source code. I already look in source code and don't find that Apollo Angular change anything relevant to fetchPolicy. I still cannot find the reason. I can make a PR which have some test case if you like. or an other PR for document if you think we need notice developer should add cache-first if you want to cache. BTW, what is the default cache policy of Apollo Angular? did I miss something?

PowerKiKi commented 1 week ago

If it still happen, please make a PR, either for a failing test case, or for a solution.