Page MenuHomePhabricator

[native] factor out UserProfileRelationshipButton condtionals
AbandonedPublic

Authored by ginsu on Sep 24 2023, 11:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 22, 4:16 AM
Unknown Object (File)
Thu, Nov 21, 10:48 PM
Unknown Object (File)
Tue, Nov 19, 7:57 PM
Unknown Object (File)
Thu, Nov 7, 11:09 PM
Unknown Object (File)
Tue, Oct 29, 8:22 PM
Unknown Object (File)
Oct 26 2024, 1:27 AM
Unknown Object (File)
Oct 20 2024, 3:41 PM
Unknown Object (File)
Oct 20 2024, 3:41 PM
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