Page MenuHomePhabricator

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

Authored by atul on Jun 2 2022, 6:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 17 2024, 11:00 AM
Unknown Object (File)
Nov 17 2024, 8:25 AM
Unknown Object (File)
Nov 9 2024, 11:41 AM
Unknown Object (File)
Nov 9 2024, 11:41 AM
Unknown Object (File)
Nov 9 2024, 11:41 AM
Unknown Object (File)
Nov 8 2024, 8:08 AM
Unknown Object (File)
Nov 5 2024, 2:02 AM
Unknown Object (File)
Oct 23 2024, 4:19 PM

Details

Summary

Instead of getting messageStore.messages from the messageStoreAfterReassignment returned by reassignMessagesToRealizedThreads(...)... we use the messageStoreOps returned by reassignMessagesToRealizedThreads(...) to compute the new messageStore.messages.

Note that a messageStore.messages is still being created within reassignMessagesToRealizedThreads(...) and will be removed in a subsequent diff


Depends on D4202

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, 6:53 PM
tomek requested changes to this revision.Jun 3 2022, 4:30 AM
tomek added inline comments.
lib/reducers/message-reducer.js
1472–1475 ↗(On Diff #13319)

We were checking if processedMessageStore is equal to messageStoreAfterReassignment so we should use processedMessageStore, right?

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

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, processedMessageStore) === false
isEqual(messageStore.messages, processedMessageStore.messages) === true

tomek added inline comments.
lib/reducers/message-reducer.js
1472–1475 ↗(On Diff #13319)

isEqual(messageStore, processedMessageStore) === false

Ok, that makes sense. But in the older code we had:

assertMessageStoreMessagesAreEqual(
  processedMessageStore,
  messageStoreAfterReassignment,
  action.type,
);

So it should be possible to replace messageStoreAfterReassignment with processedMessageStore, right?

This revision is now accepted and ready to land.Jun 20 2022, 2:52 AM
lib/reducers/message-reducer.js
1472–1475 ↗(On Diff #13319)

So it should be possible to replace messageStoreAfterReassignment with processedMessageStore, right?

We were asserting that messageStoreAfterReassignment.messages and processedMessageStore.messages were equal... but for example messageStoreAfterReassignment.threads and processedMessageStore.threads are not equal so we can't just swap them out.

rebase after cherrypicking and before addressing feedback

lib/reducers/message-reducer.js
1472–1475 ↗(On Diff #13319)

Ah, that explains a lot! Now it makes sense, thanks!