hi. I have a (`react-apollo`) component that lists...
# prisma-whats-new
f
hi. I have a (
react-apollo
) component that lists all files, and a separate upload component for uploading new files. — Q: how do I get the list to update, after a file has been uploaded? (apollo has http://dev.apollodata.com/react/cache-updates.html#refetchQueries after a mutation, but in
graphcool
file uploads aren't mutations, right?)
d
You will need to trigger a refetch yourself. the graphql HOC includes a refetch() function in the data prop that it injects into your component, so you can use this.props.data.refetch() to trigger it
You'll need to use an callback of some kind so the upload component can tell that list component that it should do this
f
thanks @dankent – will try that
j
Or use subscriptions, might work better in this case
d
I wouldn't use a subscription here because the requirement is only to update the list based on a single event that is controlled from the client side. If it was possible for things other users are doing to require the list to be updated, I would use subscriptions. I'm interested to hear a contrary view to that though