Page MenuHomePhabricator

[native, lib] Move resetUserStateActionType to lib
ClosedPublic

Authored by inka on Jul 18 2023, 11:40 AM.
Tags
None
Referenced Files
F2157342: D8531.id28919.diff
Mon, Jul 1, 1:41 AM
F2157341: D8531.id28822.diff
Mon, Jul 1, 1:41 AM
F2157340: D8531.id28782.diff
Mon, Jul 1, 1:41 AM
F2157309: D8531.diff
Mon, Jul 1, 1:37 AM
F2152465: D8531.id28822.diff
Sun, Jun 30, 3:14 PM
F2151936: D8531.id.diff
Sun, Jun 30, 1:48 PM
F2150624: D8531.id28782.diff
Sun, Jun 30, 10:49 AM
Unknown Object (File)
Sun, Jun 30, 1:59 AM
Subscribers

Details

Summary

As mentioned in https://linear.app/comm/issue/ENG-4377/refactor-cookie-field-in-web-redux I need to move resetUserStateActionType to lib, because the cookie filed will be in the KesyerveStore, that will be in BaseAppState, so it makes
sense it be reduced by a reducer from lib. And resetUserStateActionType influences the cookie field in redux-setup.js. Since the action will now be in lib, we can move the logic that reduces CurrentUserInfo when this action is called
to lib as well

Test Plan

ran yarn flow all. Checked that resetUserStateActionType is not reduced anywhere else.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

native/redux/redux-setup.js
331–340 ↗(On Diff #28782)

This had to be moved here, because now we don't want to return from this if, we need to assign state and let it continue to baseReducer. And if we do that in the if else above, then flow is not sure about the action type and shows errors

inka requested review of this revision.Jul 18 2023, 11:58 AM
michal added inline comments.
lib/actions/user-actions.js
323 ↗(On Diff #28782)

Nit: I think we prefer exporting at the end of the file instead of inline

lib/types/redux-types.js
1171 ↗(On Diff #28782)

Any reason for adding void payload here?

This revision is now accepted and ready to land.Jul 19 2023, 3:09 AM

Address review

lib/types/redux-types.js
1171 ↗(On Diff #28782)

It is required by flow