Page MenuHomePhabricator

[lib] Create thread store ops from updates in a spec
ClosedPublic

Authored by tomek on Sep 20 2023, 5:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jun 21, 9:50 AM
Unknown Object (File)
Fri, Jun 21, 9:50 AM
Unknown Object (File)
Fri, Jun 21, 9:50 AM
Unknown Object (File)
Fri, Jun 21, 9:49 AM
Unknown Object (File)
Fri, Jun 21, 9:44 AM
Unknown Object (File)
Thu, Jun 13, 10:18 PM
Unknown Object (File)
May 19 2024, 5:13 AM
Unknown Object (File)
May 19 2024, 1:15 AM
Subscribers

Details

Summary
Test Plan

Open two clients and check if making operations (e.g. updating or joining a thread) generates the right ops on the other.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested review of this revision.Sep 20 2023, 5:39 AM
kamil added inline comments.
lib/reducers/thread-reducer.js
70–80 ↗(On Diff #31310)

I think this can be simplified to return payload.updatesResult.newUpdates.map(update => ... ).filter(Boolean).flat();

lib/shared/updates/update-thread-read-status-spec.js
17–20 ↗(On Diff #31310)

nit: I think negation of this condition and early exit is more readable

This revision is now accepted and ready to land.Sep 25 2023, 2:20 AM

Add early return and use more functional approach

lib/reducers/thread-reducer.js
70–80 ↗(On Diff #31310)

Initially, I used a similar approach to what you propose, but Flow was complaining about it. Now I tried it again, and it seems to work.