Page MenuHomePhabricator

[lib][web][native] Refactor preRequestUserStateSelector
ClosedPublic

Authored by inka on Nov 6 2023, 9:16 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 4, 8:02 PM
Unknown Object (File)
Tue, Dec 31, 8:43 AM
Unknown Object (File)
Sat, Dec 28, 6:41 PM
Unknown Object (File)
Sat, Dec 28, 6:41 PM
Unknown Object (File)
Sat, Dec 28, 6:41 PM
Unknown Object (File)
Sat, Dec 28, 6:41 PM
Unknown Object (File)
Sat, Dec 28, 6:41 PM
Unknown Object (File)
Sat, Dec 28, 6:36 PM
Subscribers

Details

Summary

issue: https://linear.app/comm/issue/ENG-5379/refactor-prerequestuserstateselector
This selector is used to fetch PreRequestUserState. It is being used to be passed into setNewSession, deleteAccount and logOut actions.
setNewSession is always called in the context of one keyserver. logOut and deleteAccount may be called for one keyserver, or for many. PreRequestUserState is alway used for the same thing - invalidSessionDowngrade check (see https://linear.app/comm/issue/ENG-4685/refactor-selectors#comment-539ab029 for more details). So we want to pass into those actions an object of the same shape. But, if an action is called for one keyserver, we want to only include information about that keyserver. That's why I split the selector into two selectors.
invalidSessionDowngrade itself will be updated during https://linear.app/comm/issue/ENG-5351/refactor-web-reducer

Test Plan

Tested that the selectors work. Checked all places where preRequestUserStateSelector was being used and figured out what it was used for, and which of the new selectors needs to be used now

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lib/selectors/account-selectors.js
47 ↗(On Diff #32816)

Will be removed in the next diff

inka requested review of this revision.Nov 6 2023, 9:46 AM
kamil added inline comments.
lib/types/session-types.js
92 ↗(On Diff #32816)

can this be read-only?

This revision is now accepted and ready to land.Nov 7 2023, 3:24 AM
lib/selectors/account-selectors.js
45–92 ↗(On Diff #32888)

Thank you for typing these selectors! It makes me life easier for the Flow update

inka requested review of this revision.Nov 8 2023, 6:19 AM
This revision is now accepted and ready to land.Nov 8 2023, 6:21 AM