Page MenuHomePhabricator

[lib/native/web] refactor recordNotifPermissionAlertActionType to recordAlertActionType
ClosedPublic

Authored by ginsu on Apr 9 2024, 10:25 AM.
Tags
None
Referenced Files
F1776988: D11600.diff
Thu, May 16, 10:36 PM
Unknown Object (File)
Wed, Apr 17, 1:18 PM
Unknown Object (File)
Wed, Apr 17, 8:56 AM
Unknown Object (File)
Apr 15 2024, 11:37 PM
Unknown Object (File)
Apr 15 2024, 6:11 PM
Unknown Object (File)
Apr 15 2024, 3:52 PM
Unknown Object (File)
Apr 15 2024, 10:46 AM
Unknown Object (File)
Apr 15 2024, 9:18 AM
Subscribers

Details

Summary

This diff refactors recordNotifPermissionAlertActionType and into a more generic recordAlertActionType. I also updated the payload for this action to include the alert type so that the alert info reducer knows which alert info state in the alert store should be updated

Please note this diff + subsequent diffs won't be landed until the migration diff which will be introduced here shortly

Linear task: https://linear.app/comm/issue/ENG-7625/introduce-recordconnectfarcasteralertactiontype

Depends on D11599

Test Plan

flow + confirmed that the existing notif permission alert mechanism still works as expected

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ginsu requested review of this revision.Apr 9 2024, 10:44 AM

found a bug

ginsu requested review of this revision.Apr 9 2024, 12:06 PM
ginsu edited the summary of this revision. (Show Details)
ginsu edited the test plan for this revision. (Show Details)
ginsu added reviewers: atul, inka.

actually jk, I confused myself there is no bug with this diff

atul added inline comments.
lib/reducers/alert-reducer.js
15 ↗(On Diff #38955)

Is existing state.alertInfos[action.payload.alertType].totalAlerts expected to always be a number? Do we need to handle null/undefined case?

Looks like number is required for RecordAlertActionPayload, but is it possible for an RecordAlertActionPayload to be missing for given alertType?

21 ↗(On Diff #38955)

Feel free to keep newline if intentional

This revision is now accepted and ready to land.Apr 10 2024, 10:39 AM
lib/reducers/alert-reducer.js
15 ↗(On Diff #38955)

Spoke to @atul about this IRL but based on how RecordAlertActionPayload is typed, the dev must pass in a valid alertType into the payload. If they pass in something not valid flow will throw an error which should address @atul's concerns

Screenshot 2024-04-10 at 3.28.26 PM.png (836×2 px, 213 KB)