Hi, I'm having an issue with the User Authenticati...
# prisma-whats-new
t
Hi, I'm having an issue with the User Authentication example. I couldn't run the example as it is now, but when trying to reproduce in my code, after signing in, the user is not updated unless and refresh the all app. I used fetchPolicy 'network-only' to replace the forceFetch but still not working. Another way I made it work is to refetch the user like this
this.props.data.refetch()
Any ideas what could be the problem?
n
@tafelito would love to review a PR if you can dig deeper on this one 🙂
t
yeah I could try updating the example to use apollo 1.0 and rrv4 that is what I'm actually using now
the problem I have using refecth is that I cannot check if the user is already logged in in render, because it's trying to update the state while doing a transition
apart of that, I don't think the solution would be doing a refetch for all the data
I'll work on a PR and let you know
n
yea that would be super helpful!
t
yeah I've checked it out already but no luck
actually I just migrated the email auth example to apollo 1.0 and rrv4
I can do a PR if you want
n
yea go ahead 👍
t
the weird thing is, I'm not having the same issue there than I have on my app
n
do you use Auth0 in your app?
t
I enabled both, but I'm only using email for now
n
hm then I'm out of ideas.
t
but I'm using the example against the same endpoint
ok the only issue I see with the example is the new posts not getting refreshed
n
well it's a problem with the React Router setup, or with the user query. This problem should be independent from the endpoint itself 🙂
t
even after I used dataIdFromObject: o => o.id on the apollo client
n
yea, this needs to be handled using
updateQueries
or
update
t
yeah I guess is a problem with the RR, my app is a little different tahn the example
n
update
seems to be the recommended approach since Apollo 1, but I did not have the chance to look into that yet
t
ok I see, yeah I didn't experience with that either
ok so I'll go ahead and do the PR without that, at least the example is updated
n
that's great 🙂
t
done
n
did you use prettier for that?
t
I do
n
does it use
.eslintrc.json
as config file?
t
yes it uses that, but the project does not have any, that's why
n
alright let me create one
t
let me use that one and commit agin
n
ok thanks!
t
there
n
hm I can still see the semicolons
maybe the config is problematic
t
I usually use airbnb's
but yeah, it uses semicolons
not everywhere though
n
ok thanks for the PR I'll review in the coming days 🙂 appreciate it!
t
np
@nilan I just updated the example using the update feature, just want to let you know
now the post are refreshed after creating a new one
n
thanks will have a look tomorrow 🙂
👍 1
t
@nilan I was reading a little bit more about updates after mutation and there is a little bit of confusion in the guides. The API reference guide mention the update and updateQueries or refetchQueries while the Usage guide does not mention the update option at all. They even recommend using the refetchQueries for simpler cases while using updateQueries or the Query reducer for a more realistic scenario. They are using updateQueries in their GitHunt example. I guess that's the way to go
n
again, the most recent recommendation is to prefer
update
over
updateQueries
. That's what I heard at least 😉
t
ok I guess they'll probably update the docs soon.I'm gonna create an issue on their repo and see what they say. thanks!
n
great! Thanks for the digging 🙂