Repository navigation
Message missed live isn't restored by refresh if an older message was edited after it #415
Styry
started this conversation in
Bug reports
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
A bot posted a reply while I had the room open. The reply is in the database (bot API returns it, reload shows it), but the open page never showed it, and the reconnect/visibility refresh didn't bring it back either.
Looking at the code, I think this is the cause.
refresh_room_controller.jssends the maxdata-message-updated-aton the page assince:but
Rooms::RefreshesController#showuses it to find messages created after that time:If the page misses the append for message B and then gets a replace for an older message A edited after B was created,
sinceis now later than B'screated_atand B is never fetched. Our bot posts a "working…" message, edits it, then posts the answer, so it can hit this.Also,
visibilityChanged()only refreshes if the page was hidden for more than 60 s, so anything missed during a shorter hide isn't fetched unless the cable reconnects.Possible fix: use
data-sort-value(created_at) forsince. Edits after that point are still returned bypage_updated_since. And refresh on every return to the page:Pending messages aren't
refresh-roomtargets, so they don't affectsince. A small threshold instead of 0 would also work.We've patched our install this way. Can send a PR if this looks right.
All reactions