Page MenuHomePhabricator

[lib][native] Unwrap sendReport from callServerEndpoint
ClosedPublic

Authored by bartek on Aug 30 2023, 11:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 30 2024, 2:55 PM
Unknown Object (File)
Oct 30 2024, 2:55 PM
Unknown Object (File)
Oct 30 2024, 2:55 PM
Unknown Object (File)
Oct 30 2024, 2:55 PM
Unknown Object (File)
Oct 30 2024, 2:54 PM
Unknown Object (File)
Oct 30 2024, 2:51 PM
Unknown Object (File)
Oct 18 2024, 8:28 AM
Unknown Object (File)
Oct 18 2024, 8:27 AM
Subscribers

Details

Summary

Removed unnecessary higher-order functions.

NOTE: This could be simplified even more by getting rid of these sendReport and sendReports wrappers in report-actions.js and calling reports service directly.

Depends on D9043

Test Plan

repeated tests from D9043

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Aug 31 2023, 12:12 AM
bartek edited the summary of this revision. (Show Details)
tomek added inline comments.
lib/actions/report-actions.js
32–36 ↗(On Diff #30618)

It probably can be simplified even further

native/crash.react.js
291 ↗(On Diff #30618)

We don't have to pass it through props - we can call the imported function directly, e.g. in line 165.

This revision is now accepted and ready to land.Aug 31 2023, 5:33 AM
lib/actions/report-actions.js
32–36 ↗(On Diff #30618)

Flow is unhappy about dropping the return type of callSendReports and having void instead.

Maybe I should get rid of this wrapper and call callSendReports directly in the existing callsite of this fn? It's lib/socket/report-handler.react.js in this diff, line 75

native/crash.react.js
291 ↗(On Diff #30618)

Yes, good point

lib/actions/report-actions.js
32–36 ↗(On Diff #30618)

Usually, when we don't care about the return value, we should prefer mixed which allows both void and return values. So changing a prop type in the handler to ... => mixed might solve the issue.

Call sendReports directly from components