Page MenuHomePhabricator

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

Authored by atul on Jun 21 2022, 4:14 PM.
Tags
None
Referenced Files
F2906407: D4319.diff
Sun, Oct 6, 9:28 AM
Unknown Object (File)
Tue, Oct 1, 8:05 PM
Unknown Object (File)
Tue, Sep 24, 11:12 PM
Unknown Object (File)
Tue, Sep 24, 11:12 PM
Unknown Object (File)
Tue, Sep 24, 11:12 PM
Unknown Object (File)
Tue, Sep 24, 11:11 PM
Unknown Object (File)
Tue, Sep 24, 11:11 PM
Unknown Object (File)
Fri, Sep 20, 1:46 AM
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