Page MenuHomePhabricator

[lib] Fetch older messages when showInMessagePreview rejects messages in local store
ClosedPublic

Authored by ashoat on Oct 30 2024, 11:49 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 9:58 AM
Unknown Object (File)
Sat, Nov 16, 3:36 PM
Unknown Object (File)
Thu, Nov 14, 12:01 PM
Unknown Object (File)
Thu, Nov 14, 7:55 AM
Unknown Object (File)
Thu, Nov 14, 2:17 AM
Unknown Object (File)
Mon, Nov 11, 11:00 AM
Unknown Object (File)
Sat, Nov 9, 11:09 PM
Unknown Object (File)
Sat, Nov 9, 5:30 AM
Subscribers
None

Details

Summary

This diff implements "Potential solution 3" described on Linear here.

Depends on D13830

Test Plan

Tested in combination with the rest of the stack:

  1. Make sure membership operations (user joining / leaving) don't appear in MessagePreview
  2. Make sure reactions to the viewer's messages still appear in MessagePreview
  3. Make sure reactions to other user's messages don't appear in MessagePreview
  4. Test fresh login to thread with only one message in the last 14 days, which is a reaction to a non-viewer message. Make sure the reaction initially appears in MessagePreview, but then is replaced after more messages are fetched by the client

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

lib/hooks/message-hooks.js
127

I included this sleep here for two reasons:

  1. In case we need repeated fetches, I figured it would be better for performance to avoid having them all occur in rapid succession.
  2. There may be some delay between when the call resolves and when the Redux store is updated. Ideally we would watch the Redux store and flip setCanFetchOlderMessages when the new messages come in, but that would be rather complicated.

This approach sounds dangerous because it can potentially result in fetching a huge number of messages into memory. However, the scenario in which that could happen is almost impossible.

This revision is now accepted and ready to land.Oct 31 2024, 6:15 AM