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

Loading is "true" and data is "undefined" on route change #84

Closed
edk55 opened this issue Oct 5, 2019 · 2 comments
Closed

Loading is "true" and data is "undefined" on route change #84

edk55 opened this issue Oct 5, 2019 · 2 comments

Comments

@edk55
Copy link

edk55 commented Oct 5, 2019

Hi there! Even if the data is already in cache it shows loading: true and data: undefined on the first render of the route change. In fact the new request to the graphql api is not sending (this is not a problem, just clarifying).
I am not sure the problem is with this package, but I tried to test the issue by creating an app with same logic but with the another package (next-apollo) and there was no problem.

To reproduce the issue I created two sandboxes with the same logic but different packages (next-apollo and next-with-apollo). On the main page it loads "all users", so the data is already in cache when you are changing the route.

Codesandbox next-apollo package (correct behaviour):
Logs on route change
next-apollo package

Codesandbox next-with-apollo package (incorrect behaviour)
Logs on route change
next-with-apollo package

@wesbos
Copy link
Contributor

wesbos commented Jan 28, 2020

Apparently this is because getDataFromTree stopped working in the browser? Is that true @lfades?

I can confirm this is still an issue with "@apollo/client": "^3.0.0-beta.29", but the first log isn't happening. It logs loading false and then loading true. The data is there both times and doesn't seem to flicker on the interface at all or load my loading UI...

@lfades
Copy link
Owner

lfades commented Jan 28, 2020

Currently none of the 2 packages (or examples in Next.js) is trying to use getDataFromTree in the browser since it was updated to only work in the server, because of its high size, I'm closing the issue because there's nothing I can do from this side and the behavior is the expected (getDataFromTree won't work in a route navigation because getInitialProps gets executed in the browser).

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

No branches or pull requests

3 participants