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

NaN in heart/unicorn/bookmark count in a post #208

Closed
flexdinesh opened this issue Apr 30, 2018 · 5 comments
Closed

NaN in heart/unicorn/bookmark count in a post #208

flexdinesh opened this issue Apr 30, 2018 · 5 comments
Labels
bug always open for contribution

Comments

@flexdinesh
Copy link

BUG

Current Behavior

When I click heart/unicorn/bookmark repeatedly(laggy internet connection), I get NaN in the counts.

Expected Behavior

When I click heart/unicorn/bookmark repeatedly, number should increase and decrease by 1 alternately.

Additional Info (steps to replicate, device/browser, helpful links)

Probably this happens, when the user clicks the icon again before the async request returns for each click (can happen with slow internet).

Screenshots

NaN in all

@Zhao-Andy
Copy link
Contributor

Hey @flexdinesh, thanks for the heads up. We'll fix that bug soon!

@Zhao-Andy Zhao-Andy added the bug always open for contribution label Apr 30, 2018
@benhalpern
Copy link
Contributor

I believe this is actually a couple bugs. On the frontend we just don't properly handle errors, so the "value" of the error is the 500 message, aka NaN. On the backend we also have issues with the reaction counts getting out of order with repeated clicking. I think we could rate limit this somehow. Whoever takes this check with me about how you plan to do it.

maestromac pushed a commit that referenced this issue Aug 8, 2018
* Fix bad user_id error handling

* Remove spam user from index and remove old path
@nickyhajal
Copy link

@benhalpern Seems like on the frontend, adding a debounce should effectively rate-limit the requests: https://lodash.com/docs/4.17.10#debounce

Ideally, the UI would update optimistically and just the request to the server is debounced so it only sends with the final value.

@gatlee
Copy link
Contributor

gatlee commented Oct 5, 2018

My pull request implements optimistic rendering and addresses the visual aspect of the bug. On error, NaNs won't be shown to the user and instead gracefully reverts the state of the reaction

I'm currently working on migrating the actions bar to preact but if this is enough of a priority I could work on implementing @nickyhajal 's suggestion.

Any thoughts @benhalpern?

@maestromac
Copy link
Member

maestromac commented Nov 12, 2018

Resolved with #681 and #989

Let us know if otherwise!

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

No branches or pull requests

6 participants