Page MenuHomePhabricator

[lib] Share the state with a new device
ClosedPublic

Authored by tomek on Sep 12 2024, 7:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 14, 1:03 PM
Unknown Object (File)
Thu, Nov 14, 1:02 PM
Unknown Object (File)
Thu, Nov 14, 12:59 PM
Unknown Object (File)
Tue, Oct 29, 3:54 PM
Unknown Object (File)
Tue, Oct 22, 5:34 AM
Unknown Object (File)
Tue, Oct 22, 5:33 AM
Unknown Object (File)
Oct 18 2024, 12:48 AM
Unknown Object (File)
Oct 14 2024, 2:56 PM
Subscribers

Details

Summary

The primary device sends all the thick threads to a new device.

https://linear.app/comm/issue/ENG-9241/introduce-a-handler-that-sends-operations-to-new-devices

Depends on D13304

Test Plan

Create a new account. Create some thick threads. Log in on a new device and check if the threads appear. Close the primary, log in on a new device, open the primary - the threads should appear.

Diff Detail

Repository
rCOMM Comm
Branch
improvements
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested review of this revision.Sep 12 2024, 7:50 AM
lib/handlers/initial-state-sharing-handler.react.js
16

Do we want to make sure that only the primary device runs this handler?

31–32

Are there any risks if the new device comes online at a time that the primary is offline? I suppose the idea is that when the primary starts, it will have the old list of deviceIDs from the local store, and this effect will still trigger?

lib/shared/dm-ops/add-viewer-to-thread-members-spec.js
127–129

This comment is a bit confusing. Maybe we can rephrase:

We expect the viewer to be in the added users when the DM op is processed. An exception is for ops generated by InitialStateSharingHandler, which won't contain a messageID

Update a comment

lib/handlers/initial-state-sharing-handler.react.js
16

Yes. We're exiting early from the effect on non-primaries authMetadata.deviceID !== userDeviceIDs[0].

31–32

Yes, that's the idea. I tested it by closing the primary device's app on the iOS simulator, logging in on the web, and then opening the native app - after some time all the threads appeared. Also tested whether restarting the native app, while the web app is open, won't result in resending the threads.

lib/shared/dm-ops/add-viewer-to-thread-members-spec.js
127–129

Makes sense!

This revision is now accepted and ready to land.Sep 13 2024, 5:17 AM
This revision was automatically updated to reflect the committed changes.