Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voting does not refresh the page and it should not be allowed to vote twice on the same link #91

Open
kwoxer opened this issue Apr 10, 2020 · 2 comments

Comments

@kwoxer
Copy link

kwoxer commented Apr 10, 2020

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?

grafik

@shekharsaxena
Copy link

@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?

@kwoxer
Copy link
Author

kwoxer commented Apr 23, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants