HomePhabricator
Diffusion Comm cd7e9efe23ea

[lib] Move current user updates logic into a spec

Description

[lib] Move current user updates logic into a spec

Summary:
Introduce a new function to a spec that reduces current user store.

Use this function in a reducer - the approach is a little different from the original one:

  1. Instead of returning immediately, we reduce every update. There should be at most one CurrentUserUpdateInfo, which is the only update that affects this store, so it should be equivalent.
  2. If there were more updates affecting this store, we should apply more reductions. The updates should be sorted by timestamp on a server, so it makes sense to iterate through them using the same ordering.
  3. We always return for these actions instead of waiting for the default return state at the end.

Depends on D9257

https://linear.app/comm/issue/ENG-4241/handle-processupdatesactiontype-as-a-part-of-a-spec

Test Plan: Check if updating the current user from a different client works correctly.

Reviewers: kamil, bartek, inka

Reviewed By: kamil

Subscribers: ashoat, michal

Differential Revision: https://phab.comm.dev/D9268

Details

Provenance
tomekAuthored on Sep 22 2023, 6:18 AM
Reviewer
kamil
Differential Revision
D9268: [lib] Move current user updates logic into a spec
Parents
rCOMM0ebca826d916: [lib] Move entries updates logic into a spec
Branches
Unknown
Tags
Unknown