Skip to content

Reconnect sync does not refresh open thread and infinite message lists on DDP-only reconnects #41190

Description

@VanshajPoonia

Description

Reconnect message synchronization reconciles the main message list but not the thread panel or the infinite message list queries. After a reconnect where a message was edited or deleted while the client was offline, an already open thread or list can keep showing the stale version until that view is reopened.

Where it comes from

useLoadMissedMessages reconciles the Messages store when the connected state goes from false to true. The main room message list reads from that store, so it updates correctly.

The thread panel (useThreadMessagesQuery) and the infinite message lists (useInfiniteMessageQueryUpdates, used by discussions, the threads list and omnichannel history) keep their own React Query caches that are only fed by live room-messages and notify-room/deleteMessage / deleteMessageBulk stream events. Those streams do not replay what was missed while offline.

React Query's refetchOnReconnect default does refresh these caches, but only when its online manager fires, which is driven by the browser navigator.onLine offline/online events (see apps/meteor/client/lib/queryClient.ts, which keeps the default). So a plain network drop is covered.

When it is visible

It shows up on a DDP socket reconnect that does not come with a browser online event, for example a server restart, a proxy blip, or laptop sleep/wake where the socket dropped but the OS still reported online, while a thread or list was open the whole time.

Steps to reproduce

  1. Open a thread in a room
  2. Keep the client running but drop only the DDP connection (for example restart the server) so the browser never fires an offline event
  3. From another user, edit or delete a message inside that thread while the first client is disconnected
  4. Let the first client reconnect
  5. The main message list is correct, but the open thread still shows the old content until it is closed and reopened

Suggested direction

Reconcile the affected React Query caches on the same reconnect edge, so threads, discussions, the threads list and omnichannel history are refreshed together rather than each relying on the browser online signal. Worth deciding how broad the invalidation should be to avoid refetching every open list on every reconnect.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions