Skip to content
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

Server caches blocks/transactions responses #3

Closed
mhuggins opened this issue Sep 15, 2017 · 4 comments
Closed

Server caches blocks/transactions responses #3

mhuggins opened this issue Sep 15, 2017 · 4 comments
Labels

Comments

@mhuggins
Copy link
Member

Not sure if this is an issue with the actual HTML response being cached or the graphql results getting stuck in memory somehow. This only happens when the server generates the HTML for either the /blocks or /transactions route, not when it is client rendered (after first hitting the home page, for example).

@mhuggins mhuggins added the bug label Sep 15, 2017
@mhuggins
Copy link
Member Author

mhuggins commented Sep 15, 2017

Fixed.

@mhuggins mhuggins reopened this Sep 16, 2017
@mhuggins
Copy link
Member Author

Turns out the "network-only" fetchPolicy is not working on the server. The react-apollo code is explicitly changing the value to use "cache-first" for some reason: https://github.com/apollographql/react-apollo/blob/1b28d92cf1a09fe28c40cbad91b31a0208313663/src/graphql.tsx#L417-L422.

See issue here: apollographql/react-apollo#556.

Possible solution is to switch to using the withApollo higher-order component, which would provide the ApolloClient instance. I could then use that to make a request with forceFetch: true maybe. (Can't really find any documentation on forceFetch to support that idea though.)

@mhuggins
Copy link
Member Author

As a workaround, I've set the ssr: false option on all graphql requests. The downside is that the server always renders a loading state instead of providing recent data.

@mhuggins
Copy link
Member Author

Closing this for now since my workaround is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant