Page MenuHomePhabricator

[native, lib] Move resetUserStateActionType to lib
ClosedPublic

Authored by inka on Jul 18 2023, 11:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 2:15 AM
Unknown Object (File)
Thu, Dec 12, 1:40 AM
Unknown Object (File)
Mon, Nov 25, 1:56 AM
Unknown Object (File)
Nov 23 2024, 12:51 PM
Unknown Object (File)
Nov 10 2024, 10:54 PM
Unknown Object (File)
Nov 10 2024, 10:53 PM
Unknown Object (File)
Nov 10 2024, 10:53 PM
Unknown Object (File)
Nov 9 2024, 9:42 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