Page MenuHomePhabricator

[lib] Create a redux store where ops will be stored
ClosedPublic

Authored by tomek on Mar 6 2024, 9:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 25, 12:49 PM
Unknown Object (File)
Thu, Apr 25, 12:48 PM
Unknown Object (File)
Fri, Apr 12, 3:37 AM
Unknown Object (File)
Thu, Apr 11, 5:55 PM
Unknown Object (File)
Thu, Apr 11, 2:30 PM
Unknown Object (File)
Thu, Apr 11, 6:42 AM
Unknown Object (File)
Wed, Apr 10, 9:15 PM
Unknown Object (File)
Wed, Apr 10, 8:30 PM
Subscribers

Details

Summary

Create the store. By default, it should contain an empty array.

https://linear.app/comm/issue/ENG-7096/add-a-new-field-in-redux-where-ops-are-stored

Test Plan

Inspect Redux on web and native and check if the store is present. Also close and reopen the app to make sure that there are no inconsistencies.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested review of this revision.Mar 6 2024, 10:51 AM

Can you explain why we don't want to persist ops? Wouldn't it be a problem if redux store got updated, but the app was closed before ops had the time to update the db?

lib/types/db-ops-types.js
6 ↗(On Diff #37895)

What is this used for?

12 ↗(On Diff #37895)

What is this used for?

In D11259#325290, @inka wrote:

Can you explain why we don't want to persist ops? Wouldn't it be a problem if redux store got updated, but the app was closed before ops had the time to update the db?

In the current design the flow should be like this:

  1. Receive message
  2. Decrypt
  3. Processing in redux and database
  4. Confirm

If we want to persist this, we could end up in a scenario where we open the app, and we have:

  1. Processing in redux and database
  2. Confirm

This requires implementing some additional things like remembering messageIDs, confirming not from the socket level but from the component responsible for processing etc.. With the current approach we will just start the flow again, it could be improved in the future but I think for now it might not be worth it.

lib/types/db-ops-types.js
6 ↗(On Diff #37895)

We need a mapping between actions and ops - https://linear.app/comm/issue/ENG-7094/introduce-a-mapping-between-actions-and-ops. The plan is for each action that we want to track, to introduce an ID which then can be used when an ops processing finishes.

12 ↗(On Diff #37895)

If an action doesn't generate ops we can immediately report its completion to the caller. This array allows us to do that because we don't need to wait for other ops to complete.

kamil added inline comments.
lib/types/db-ops-types.js
12 ↗(On Diff #37895)

it could be helpful to add comment in code explaining this

This revision is now accepted and ready to land.Mar 11 2024, 4:01 AM

Add a comment. Update the types.

We don't need a second ID - removing the ops ID