Page MenuHomePhabricator

[lib][native][web][landing] Silence unused-promise using void keyword
ClosedPublic

Authored by ashoat on Dec 4 2023, 1:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 15, 10:08 PM
Unknown Object (File)
Sun, Dec 15, 10:08 PM
Unknown Object (File)
Sun, Dec 15, 10:08 PM
Unknown Object (File)
Sun, Dec 15, 10:08 PM
Unknown Object (File)
Sun, Dec 15, 10:08 PM
Unknown Object (File)
Sun, Dec 15, 10:08 PM
Unknown Object (File)
Sun, Dec 15, 10:07 PM
Unknown Object (File)
Sun, Dec 15, 10:07 PM
Subscribers

Details

Summary

The Flow team recommends using the void keyword to silence the unused-promise Lint. See the "Fire-and-forget" part of this blog post.

In this diff, I add the void keyword to a bunch of places in native, web, landing, and the parts of lib that are only used from native/web/landing. In these contexts it's safe to ignore promise rejections, because unlike Node.js there are no negative consequences to it. In contrast, we need to be more careful in keyserver (and potentially desktop?) because Node.js will crash when it encounters an unhandled promise rejection.

Depends on D10175

Test Plan

Flow

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Dec 4 2023, 1:52 PM
Harbormaster failed remote builds in B24755: Diff 34218!
ashoat published this revision for review.Dec 4 2023, 6:27 PM
michal added inline comments.
lib/components/base-edit-thread-avatar-provider.react.js
86–89 ↗(On Diff #34234)

Unrelated, but is there a reason why we await the promise directly instead of dispatchActionPromise? It seems like it would work the same.

This revision is now accepted and ready to land.Dec 5 2023, 5:44 AM
lib/components/base-edit-thread-avatar-provider.react.js
86–89 ↗(On Diff #34234)

I had the same thought, but I wasn't sure enough to make this change. It seems to depend on the internals of react-redux/redux-thunk and I didn't have time to delve into it

This revision was landed with ongoing or failed builds.Dec 5 2023, 12:33 PM
This revision was automatically updated to reflect the committed changes.