Page MenuHomePhabricator

[native] Avoid running the handler multiple times
ClosedPublic

Authored by tomek on Feb 27 2025, 6:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 4, 4:15 PM
Unknown Object (File)
Fri, Apr 4, 10:45 AM
Unknown Object (File)
Fri, Apr 4, 1:21 AM
Unknown Object (File)
Thu, Apr 3, 4:49 AM
Unknown Object (File)
Wed, Apr 2, 9:04 PM
Unknown Object (File)
Wed, Apr 2, 2:31 AM
Unknown Object (File)
Tue, Apr 1, 11:37 PM
Unknown Object (File)
Tue, Apr 1, 12:18 AM
Subscribers

Details

Summary

The effect contains some async logic that is run based on a condition that is later modified in the effect. This means that it is possible to run this effect multiple times before the condition is noticed to be true (without this change the logic runs usually 4 times).

https://linear.app/comm/issue/ENG-10271/generating-backups-for-siwe-users-who-used-v1-fallback-doesnt-work

Test Plan

Check if the logic is run just once, by adding some console logs. This code can be run when a SIWE user doesn't have a backup.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested review of this revision.Feb 28 2025, 6:00 AM

Delete unnecessary dependency

Update the ref immediatelly

kamil added inline comments.
native/account/registration/missing-registration-data/missing-registration-data-handler.react.js
41 ↗(On Diff #47291)

I would also call this in the final step of the promise below to avoid waiting for re-render, but this should also do the job

87 ↗(On Diff #47291)

I think this can be removed now?

This revision is now accepted and ready to land.Feb 28 2025, 7:46 AM