you need to be able to provide the query with the ...
# prisma-whats-new
e
you need to be able to provide the query with the userId by nature of how a query works. You could use localStorage to avoid passing it about via props, or keep it in Redux, depending on your project
a
Do you know how performant it is to keep it in redux? is it slow?
m
when querying on the user, it normally assumes it's the logged in user. Therefore there's no need to provide the userId yourself. I was having a problem with react-apollo / apollo-client and found out I had to pass back id on the user for it to register in the store 😄
j
This is not true. Quering for
user { }
will get the currently logged in user (via auth headers)
e
If you see how the howtographql tutorial instructs on user auth, local storage is used for retaining the user id. As far as performance goes, just think about what it takes to get an item from local storage versus getting an item from your redux store. I personally use vue, so I would use vuex and therefore don't have a knowledgeable opinion on which is better. When in doubt, you can always bench test the operation in question. This seems trivial, however, for such a small operation. You'll be the best judge for your use case. In the end if the ux is fine either way, just do what feels most natural with your dev style.
If you need a short and simple deciding factor: if you don't need redux in your app aside from this, find another way. No reason to bloat your sites dependencies