-
Notifications
You must be signed in to change notification settings - Fork 10
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
reduce duplicate fetches for cache.json by storing in client.js memory #347
Comments
You cannot cache them in client.js because it's not a singleton. A new instance is created every single route change, for each component that imports it. |
We can however reuse the Modify client.js like so: client.query = (params) => {
if (APOLLO_STATE && Object.keys(APOLLO_STATE).length === 0) { and it will use the apollo_state on initial page load. The problem is when the route changes, with this condition it will try to reach graphql server. |
Basically if we provide client side routing of any kind (SPA / hybrid model), then we should expect to have to reload the whole page (app shell) if we want things to work as would expect in SSG mode (which would be doing a full page reload) Part of paying the cost to enable going beyond just progressive enhancement. But makes things simpler for at least achieve SSG mode. 😄 |
Moving to deferred for this project to be added to our next project, but it looks we can take advantage of the work being deon for adding an MPA setting in #477 to implement what we need for this feature. More info here - #487 (comment) |
Type of Change
Summary
As a minor optimization for client.js, it would be good to cache in memory previously
fetch
ed calls to cache.json.Details
In this way, the browser won't have to make redundant HTTP requests to something it already has access to.
The text was updated successfully, but these errors were encountered: