Page MenuHomePhabricator

[lib] Share the state with a new device
ClosedPublic

Authored by tomek on Thu, Sep 12, 7:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 27, 3:35 AM
Unknown Object (File)
Mon, Sep 23, 1:41 AM
Unknown Object (File)
Sun, Sep 22, 9:37 PM
Unknown Object (File)
Sat, Sep 21, 3:55 PM
Unknown Object (File)
Sat, Sep 21, 3:45 PM
Unknown Object (File)
Sat, Sep 21, 7:14 AM
Unknown Object (File)
Sat, Sep 21, 5:58 AM
Unknown Object (File)
Fri, Sep 20, 8:48 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested review of this revision.Thu, Sep 12, 7:50 AM
lib/handlers/initial-state-sharing-handler.react.js
16 ↗(On Diff #44086)

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

31–32 ↗(On Diff #44086)

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 ↗(On Diff #44086)

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 ↗(On Diff #44086)

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

31–32 ↗(On Diff #44086)

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 ↗(On Diff #44086)

Makes sense!

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