reallyreadit/web

Seeming double post in the web reader

Opened this issue · 1 comments

When posting an article in the web reader on Chrome, it appears twice in the comment section:

CleanShot 2023-04-12 at 12 11 41

A refresh of the reader page reduces it to one, from which I assume only one was posted & persisted (as intended).

Reproduction

I'm not sure under which exact conditions this happens. It might only occur when someone else's post is already visible on the article, when you are not the first one to post an article.

Possible cause

One hypothesis to test:

  • Upon posting, the comment list component signals the extension event page or server API that a new comment was posted to the.
  • The comment list component inserts the newly posted comment itself, before or after it has received confirmation that the post succeeded.
  • The extension event page/server API signals the comment list component via an event, or via updated props, that a new comment was posted, leading to a duplicate to be merged in.

Just had it happen to me on this comment: https://readup.org/comments/opencollectivecom/2023-annual-update---open-collective/zxEwJD

Your hypothesis sounds very likely to me! Seems like some weird feedback loop with the UI events only (thankfully). Though I almost tried to delete the "duplicate" post which probably would have actually deleted the original which makes this worse than just a little glitch.