github.com/shurcooL/issuesapp/...

It's possible to accidentally double-post. #33

Opendmitshur opened this issue 3 years ago
dmitshur commented 3 years ago · edited

E.g., see https://dmitri.shuralyov.com/issues/github.com/shurcooL/notificationsapp/6#comment-3.

I was able to reproduce it on purpose.

It can happen if you press "Comment" button two times in rapid succession. The second press has to happen before the first comment finishes being posted.

This may also affect creating threads, but I haven't confirmed.

Write Preview Markdown
dmitshur commented 3 years ago · edited

This may also affect creating threads, but I haven't confirmed.

Yep, it can happen just the same for creating new threads. Confirmed.

Write Preview Markdown
dmitshur commented 3 years ago

The fix isn't trivial (mostly due to lack of React-like framework).

We'd want to disable the "Comment" button after it's been pressed, and re-enable it after we get a response from the server.

The tricky part is getting it right in all situations, like posting a new thread, posting a new comment, updating an existing comment, and finally posting comment + closing/reopening thread at once. We should also apply this double-action-prevention logic for close/reopen button too.

Probably revisit this later. Until then, avoid accidentally pressing buttons more than once.

Write Preview Markdown
to comment.