react-apollo
react-apollo copied to clipboard
Voting does not refresh the page and it should not be allowed to vote twice on the same link
I have the issue that when I hit the vote button, the page is not refreshed. So when I hit the vote button again the page crashed with the error Already voted for link.
Is this only happening to me?

@kwoxer I noticed this too. There is a slight delay, but it does refresh on its own eventually (within a few seconds). I think that throwing the error is by design, as you can see on the server side that it will throw an error if you try voting again.
if (linkExists) { throw new Error(Already voted for link: ${args.linkId}) }
Also, something that is related, that I am dealing with. Did you see the vote refresh on the frontend on its own, without the need to update the local cache. For me, if I click, and wait a few seconds, the vote increases by 1. I can remove the "updateStoreAfterVote" prop from the mutation, and the vote still increases. Anyone seeing this?
I solved the issue with this video: https://www.youtube.com/watch?v=dr9I4xPYkdw
It's just adding the SnackBar and easy-peasy. And adding the errorhandling as link to Apolloconfig. And that's it.
Now the error is just triggered as a popup and does not let the page of the user crash anymore. Also the error is still logged in the console.
This should really be added to this repository as it's a huge benifit. I searched for this for some days to get it.
@shekharsaxena I'm not sure what you mean with voting again. Everything worked for me except that the page crashed.