馃悰 Rapidly double clicking on `Comment` button causes two database writes
Created by: Tirokk
Authored by mattwr18 Closed
馃悰 Bugreport
At the moment, if you rapidly click on the Comment
button, it is possible to create multiple comments with the same content.
Currently, in the handleSubmit
method, the button is disabled and set to loading, but it is still possible to fire two events before the button is disabled and apollo is sending two requests.
Steps to reproduce the behavior
- visit
/
- click on a post
- write a comment
- click rapidly twice on the
Comment
button
Expected behavior
There should be some way of handling this situation, if a user wants to comment the same thing twice, for whatever reason, they should need to type the same message/copy && paste it.
More often than not, this will happen by accident, and therefore we should have some protection against this.
have found this https://github.com/Akryum/vue-apollo/issues/185
which suggests that adding optimisticResponse
prevents two database writes https://github.com/Akryum/vue-apollo/issues/185#issuecomment-364696038
I've yet to successfully test this in favor of opening a new issue to explore options
Version & Environment
Type: []
- OS: []
- Browser: []
- Version []
- Device: []