Page MenuHomePhabricator

[native] factor out UserProfileRelationshipButton condtionals
AbandonedPublic

Authored by ginsu on Sep 24 2023, 11:39 PM.
Tags
None
Referenced Files
F3000531: D9273.diff
Fri, Oct 18, 2:16 AM
Unknown Object (File)
Sat, Oct 12, 5:38 PM
Unknown Object (File)
Sat, Oct 12, 11:24 AM
Unknown Object (File)
Sun, Oct 6, 8:25 AM
Unknown Object (File)
Sun, Oct 6, 4:54 AM
Unknown Object (File)
Sun, Oct 6, 3:50 AM
Unknown Object (File)
Sep 13 2024, 2:57 AM
Unknown Object (File)
Sep 13 2024, 2:57 AM
Subscribers

Details

Reviewers
atul
inka
Summary

These conditionals will be needed in multiple places. To preemptively prepare for this, I am factoring out these conditionals into their own variable so that we can have less redundant code

Depends on D9272

Test Plan

flow

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Personally would prefer to inline these conditions but it doesn't matter a ton

native/user-profile/user-profile-relationship-button.react.js
88–90

Eh I don't love the indirection here, would prefer if the conditional logic was closer to the conditional... especially when showNothing tells us nothing about the logic whereas eg showIncomingFriendRequestButtons gives us some idea of what the condition is.


We could also instead have the pattern of

let userProfileRelationshipButton;
if (showIncomingFriendRequestButtons) {
  userProfileRelationshipButton  = ...

and let the null case be implicit

This revision is now accepted and ready to land.Sep 26 2023, 1:44 PM

Personally would prefer to inline these conditions but it doesn't matter a ton

Thought about this some more, and I agree with @atul here. This feels a bit unnecessary and will abandon this diff in favor of keeping these conditions inline