but I’m having issues with a lot of requests being...
# prisma-whats-new
a
but I’m having issues with a lot of requests being sent
h
a
But what is the recommended way to do it?
having a lot of
graphql
everywhere close to the component, or one big one and pass props
h
depends on size of application i think
if you have many components its better idea to couple graphql with each component
r
but am I correct in assuming that if you fetch a post that is already in the cache, it will not call the server?
h
depends of query setings you can force to refetch
r
no no, I dont want that šŸ™‚ I prefer to use the cache. But apollo is smart enough for that I take it
f
From my still very small experience with Apollo caching is default behavior, you have to explicitly tell it to not cache
@huv1k thanks for sharing the batching its pretty awesome
h
yea, but if you for example mutate query, you can change it in cache
r
got it
thanks šŸ™‚
h
but i am not expert šŸ˜„
everything is from my observations i made
r
but there is no performance penalty when wrapping multiple components in HOCs right?
h
there is always šŸ™‚
more code to execute
r
right, so what do you do? pass props or wrap components in hocs?
h
i wrap components because of readability code
but i am not right person to ask about stuff like this, i dont have enought experiences with big projects šŸ™‚
or complicated applications šŸ™‚
f
On the app I'm building the pattern we adopted is we have view components (that match a react-router url) that are wrapped and pass down data via props to its child
The few exception being a notification widget that is living in it's own word
as well as a messenger like thingy that works independently with subscriptions
r
what about stuff like currentUser? A lot of components need that info right?
h
depends on your application šŸ™‚
r
so there is no best practice in the community?
f
currentUser is hooked to most of our view components
Actually we are thinking having it hooked to the main App and passed to the views as props
r
so to each prop youd pass currentUser then?
interesting
im having a lot of props being passed everywhere and it gets a bit convoluted
f
I guess the best practice is when you find yourself in this situation you should refactor šŸ™‚
But if performance is your worry I think the best is to first track re renders when testing your app
r
its not really my worry, Im just not really experienced
I would like to adhere to best practices
so thats why I asked
its not that im suffering from bad performance or huge rerenders at the moment