-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Apollo cache policy #9296
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Modified Apollo Client's fetch policy in useApolloFactory to improve real-time data synchronization across collaborative workspaces.
- Changed default fetch policy from 'cache-first' to 'cache-and-network' in
/packages/twenty-front/src/modules/apollo/hooks/useApolloFactory.ts
- Moved fetch policy configuration from 'query' to 'watchQuery' for proper application to all watched queries
- Increased server load expected due to network requests on every query, even with cached data
- Previous fetch policy setting was likely ineffective due to incorrect configuration location
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
@FelixMalfait Are we sure that the backend will scale accordingly ? If yes let's try and see how it goes, maybe we can release it under a feature flag if it's too risky. |
As a reminder for the conversation, here are the fetch policies : https://www.apollographql.com/docs/react/data/queries#supported-fetch-policies |
I'll do a round of tests with fetch more to see how it behaves in local development also, which can be a concern for contributors |
Thanks @lucasbordeau I tested it locally no issue, it worked well for me. |
It's ok for me, thanks to fetch more there's no real difference, plus there is not a noticeable difference, because the component loading takes more time than the network rounds. |
Let's if we have problems in the future with this but seems like we can be confident. |
Set the default cache policy to 'cache-and-network' to make sure user get more fresh data without refreshing the browser. Better for workspace with several users working at the same time.
It will put more load on the server...
Note: I don't think the previous setting was taken into account