Skip to content

Commit

Permalink
[native] update baseNoDataAfterPolicyAcknowledgmentSelector check
Browse files Browse the repository at this point in the history
Summary:
Discovered while looking at [ENG-5883](https://linear.app/comm/issue/ENG-5883/rahul-sees-socket-crash-loop-due-to-policy-acceptance-issue).

This selector was not sufficiently specific; we should not only verify that all policies are accepted but also check if any policy has been accepted. The previous version could inaccurately return a truthy value in cases other than the absence of data following policy acknowledgment.

Note: In most standard use cases, userPolicies is empty. It's only populated when policies need to be accepted with falsy flags, and right after acknowledgment, to handle cases such as this one.

Test Plan:
1. Test policies mechanism
2. Test policies with socket issues
3. Make sure in other cases this condition is falsy

Reviewers: tomek, michal, inka

Reviewed By: tomek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D9965
  • Loading branch information
xsanm committed Nov 27, 2023
1 parent 1964186 commit 3038ee4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions native/selectors/account-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const baseNoDataAfterPolicyAcknowledgmentSelector: (
) =>
connectivity.connected &&
currentAsOf === 0 &&
values(userPolicies).length > 0 &&
values(userPolicies).every(policy => policy.isAcknowledged),
);

Expand Down

0 comments on commit 3038ee4

Please sign in to comment.