Page MenuHomePhabricator

[lib] Update `messageStore.messages` with `msgStoreOps` for createLocalMessage
ClosedPublic

Authored by atul on Jun 2 2022, 7:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 9, 11:41 AM
Unknown Object (File)
Sat, Nov 9, 11:41 AM
Unknown Object (File)
Sat, Nov 9, 11:41 AM
Unknown Object (File)
Fri, Nov 8, 8:08 AM
Unknown Object (File)
Tue, Nov 5, 2:02 AM
Unknown Object (File)
Fri, Nov 1, 11:46 PM
Unknown Object (File)
Wed, Oct 23, 4:20 PM
Unknown Object (File)
Wed, Oct 23, 4:20 PM

Details

Summary

Instead of using messageStore.messages from the previous updatedMessageStore object... we pull it from the processedMessageStore object.

We actually remove updatedMessageStore altogether and include the changes to updatedMessageStore.threads in the messageStore of the returned object.


Depends on D4203

Test Plan

This should be a straightforward refactor given we've had assertMessageStoreMessagesAreEqual in place for some time now.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul requested review of this revision.Jun 2 2022, 7:08 PM
tomek requested changes to this revision.Jun 3 2022, 4:32 AM
tomek added inline comments.
lib/reducers/message-reducer.js
1380–1387 ↗(On Diff #13320)

We were comparing updatedMessageStore with processedMessageStore so maybe we should use processedMessageStore. Additional modification of threads is concerning - are you sure we need that?

This revision now requires changes to proceed.Jun 3 2022, 4:32 AM
atul requested review of this revision.Jun 17 2022, 1:47 PM
atul added inline comments.
lib/reducers/message-reducer.js
1380–1387 ↗(On Diff #13320)

Right now the "ops-approach" only modifies messageStore.messages, we'll need to "get the rest" of the messageStore using the old way

isEqual(messageStore, updatedMessageStore) === false
isEqual(messageStore.messages, updatedMessageStore) === true

tomek added inline comments.
lib/reducers/message-reducer.js
1380–1387 ↗(On Diff #13320)

We were asserting that updatedMessageStore and processedMessageStore had the same content so it should be possible to use processedMessageStore. Am I missing something?

This revision is now accepted and ready to land.Jun 20 2022, 3:09 AM
lib/reducers/message-reducer.js
1380–1387 ↗(On Diff #13320)

We were asserting that updatedMessageStore.messages and processedMessageStore.messages had the same content, but for example updatedMessageStore.threads and processedMessageStore.threads will be different

rebase after cherrypicking and before addressing feedback