Page MenuHomePhabricator

[lib] update message reducer to use ops approach for local field
ClosedPublic

Authored by ginsu on Jun 7 2024, 5:02 PM.
Tags
None
Referenced Files
F3380835: D12358.diff
Thu, Nov 28, 2:39 AM
Unknown Object (File)
Tue, Nov 12, 4:33 PM
Unknown Object (File)
Tue, Nov 12, 4:29 PM
Unknown Object (File)
Tue, Nov 12, 2:45 PM
Unknown Object (File)
Fri, Nov 8, 7:14 PM
Unknown Object (File)
Fri, Nov 8, 7:14 PM
Unknown Object (File)
Fri, Nov 8, 1:52 PM
Unknown Object (File)
Sat, Nov 2, 4:14 AM
Subscribers

Details

Summary

Refactor the local field in the message reducer + relevant util functions in this file to use the ops approach

Depends on D12357

Test Plan

Tested each action type w/ @will during the hackathon, and we were able to confirm that we were getting the expected behavior for each action

Some of the main user flows we tested:

  1. fail sending a message
  2. successfully retry sending a message
  3. closing the app where a thread had a bunch of sent failed local messages
  4. fail sending a reaction message
  5. deleting a thread with a bunch of sent failed messages

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ginsu requested review of this revision.Jun 7 2024, 5:20 PM
tomek requested changes to this revision.Jun 10 2024, 3:40 AM
tomek added inline comments.
lib/reducers/message-reducer.js
791–792 ↗(On Diff #41133)

Why don't we set the local here? Shouldn't we set it for all the actions? Maybe we can even spread the processed store?

901 ↗(On Diff #41133)

Shouldn't we also set the local? Could you explain here, and in all the other places, why we're not setting the local?

1583–1586 ↗(On Diff #41133)

It is surprising to see an action where we're adding some ops without removing the old logic. Originally, we weren't modifying the messageStore.local, and now we do. What is the reason?

This revision now requires changes to proceed.Jun 10 2024, 3:40 AM

We should also check for store inconsistencies in setClientDBStoreActionType - but I guess that extending this action will be done later in the stack.

lib/reducers/message-reducer.js
791–792 ↗(On Diff #41133)

Was thinking that since messageStore.local was not being touched it would be fine to not explicitly set local here, but now I can see that it would be best to be explicit here and also set local

1583–1586 ↗(On Diff #41133)

I think initially during the hackathon the thinking was that since these are the ops for the createLocalMessageActionType it might make sense to add a "shell" local message info; however, after thinking about it some more, this is unnecessary/redundant, and can be removed

We should also check for store inconsistencies in setClientDBStoreActionType - but I guess that extending this action will be done later in the stack.

D12384

lib/reducers/message-reducer.js
1583 ↗(On Diff #41228)

Noticed we were missing setting threads here so snuck this change in

tomek added inline comments.
lib/reducers/message-reducer.js
791–792 ↗(On Diff #41133)

For me, the benefit of having local here is that the logic from the reducer and from the ops processing get decoupled - the reducer doesn't need to know any detail about how the result of ops processing will look.

This revision is now accepted and ready to land.Jun 12 2024, 4:09 AM