Page MenuHomePhabricator

[lib] Simplify conditional logic in `wrapActionPromise:loadingInfo`
ClosedPublic

Authored by atul on Jun 21 2022, 4:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Sep 4, 1:07 PM
Unknown Object (File)
Wed, Sep 4, 1:07 PM
Unknown Object (File)
Mon, Sep 2, 3:02 PM
Unknown Object (File)
Thu, Aug 29, 3:35 PM
Unknown Object (File)
Mon, Aug 19, 10:38 PM
Unknown Object (File)
Jul 23 2024, 2:51 PM
Unknown Object (File)
Jul 19 2024, 11:19 AM
Unknown Object (File)
Jul 11 2024, 4:31 PM
Subscribers

Details

Summary

Noticed that some of the logic here could be simplified w/ optional chaining + nullish coalescing... so made those changes

Test Plan

Close reading + flow

Diff Detail

Repository
rCOMM Comm
Branch
june21 (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

atul requested review of this revision.Jun 21 2022, 4:19 PM

Looks good to me. Nice catch!

This revision is now accepted and ready to land.Jun 22 2022, 7:34 AM
This revision now requires review to proceed.Jun 22 2022, 9:22 AM
tomek requested changes to this revision.Jun 22 2022, 9:35 AM
tomek added inline comments.
lib/utils/action-utils.js
64

This changes the behavior when loadingOptions is non-null and customKeyName is an empty string ''.
In the previous code, the result would be null. In the new code, the result is ''. The solution to keep the behavior consistent is to use || instead of ??.

This revision now requires changes to proceed.Jun 22 2022, 9:35 AM
lib/utils/action-utils.js
64

Ah thanks for catching that subtle bug.

Will update this diff to use || instead of ??

dd38d4.png (648×2 px, 554 KB)

address feedback from @palys-swm

This revision is now accepted and ready to land.Jun 23 2022, 2:09 AM

rebase after cherrypicking and before landing