Page MenuHomePhabricator

[native] Fix useIsCurrentUserStaff hook
ClosedPublic

Authored by tomek on Mar 7 2023, 2:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 28, 4:51 AM
Unknown Object (File)
Fri, Mar 1, 9:53 AM
Unknown Object (File)
Fri, Mar 1, 9:53 AM
Unknown Object (File)
Fri, Mar 1, 9:52 AM
Unknown Object (File)
Fri, Mar 1, 9:49 AM
Unknown Object (File)
Feb 21 2024, 4:04 AM
Unknown Object (File)
Feb 21 2024, 12:27 AM
Unknown Object (File)
Feb 21 2024, 12:27 AM
Subscribers

Details

Summary

This hook was introduced in D5498 and incorrectly used useSelector from react-redux which isn't typed. That meant that the result of this hook was incorrectly typed as boolean while in fact it was something like undefined | null | string | boolean. The issue wasn't detected because we were simply checking truthiness of the value. In D6949 we started using this value as a query param and converted it to it using .toString method, which was failing when the returned value was null / undefined.

Test Plan

After updating the import Flow checks the types correctly. Also logged out and checked if fetching feature flags config works correctly.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable