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)
Sat, Jul 6, 10:56 AM
Unknown Object (File)
Sat, Jul 6, 4:21 AM
Unknown Object (File)
Sat, Jul 6, 4:21 AM
Unknown Object (File)
Sat, Jul 6, 4:21 AM
Unknown Object (File)
Sat, Jul 6, 4:21 AM
Unknown Object (File)
Sun, Jun 30, 6:06 PM
Unknown Object (File)
Sun, Jun 30, 5:33 PM
Unknown Object (File)
Sun, Jun 30, 1:35 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #13640)

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 ↗(On Diff #13640)

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