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

The Me query #60

Open
cuanms opened this issue Aug 5, 2022 · 2 comments
Open

The Me query #60

cuanms opened this issue Aug 5, 2022 · 2 comments

Comments

@cuanms
Copy link

cuanms commented Aug 5, 2022

The Me query
const [{data, fetching,}] = useMeQuery()
is called twice when the page. I tried removing the<React.StrictMode> but it still gets called twice.
it loads once with no data and then a second time with data and it makes a user component that I made blink. is there a way to wait for it to load and then check for the data or to check for the data before rendering the page? New to this thank you

@csandoval18
Copy link

I noticed that too during my implementation. There is no drawback to this. It's not gonna tank your app performance since the request is only called once to the server. You can check by going to the Devtools > Network and checking all the graphql request and responses. The me query post request should appear once in the network tab. If you wanna experiment try wrapping it in a useEffect hook. Either way I would say not to worry about it since Ben makes a lot of changes regarding how the data is rendered from the server or client throughout the tutorial.

@cuanms
Copy link
Author

cuanms commented Aug 11, 2022

Thank you for the help, I also use the fetching that we destructured from the useMeQuery to make sure that my component doesn't display while it is fetching

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

2 participants