-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 query overwrites updateQueries response #1223
Comments
Not sure if this is the exact same issue, but your experience sounds similar to my current problem, but I'm using navigate to EventOverview (fetch event) |
@RAFREX Thanks for the detailed writeup. That sounds like a tricky issue, but very reproducible. Do you think you could write a failing test case? I think a good place to put it would be this file. @BlooJeans I think |
Closing for lack of activity. If this is still a problem, please open a new issue. |
I have a
login
mutation with anupdateQueries
option that updates my current user query.This works fine in isolation, the
currentUser
query is updated with the userid
andusername
and myUser
React component gets the new current user data exactly as is should. However, when I have a current user, myUser
component renders aUserInfo
component which has acurrentUserInfo
query.When this query runs it first has
data.loading: true
, as it should, but it also updates the result of thecurrentUser
query so theuser
isnull
(note that loading for thecurrentUser
query isfalse
, so it's saying it's finished loading and has anull
user
), which gets passed into myUser
component and causes problems.Note that this is all happening synchronously:
login
mutation result updatescurrentUser
query with logged in user >User
component gets new current user data and renders theUserInfo
component >UserInfo
component runscurrentUserInfo
query >currentUser
query is updated withuser
asnull
>User
component gets new current user data withnull
user
>User
component un-mountsUserInfo
component.If I change it so the
UseInfo
component is rendered asynchronously (with asetTimeout
of 0), everything works as it should andcurrentUser
is not updated withuser
asnull
.Also, if the
currentUser
query is first run because theUser
component is rendered (and there is a current user, say on a page reload), then the synchronous process works fine. It's only when it starts withupdateQueries
from thelogin
mutation that the issue arises.Note that both
User
andUserInfo
have respectiveUserWithData
andUserInfoWithData
containers that I didn't explicitly name above.Using
apollo-client
0.8.0 andreact-apollo
0.8.3.The text was updated successfully, but these errors were encountered: