Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote Functions: Change how webclient options are constructed in CustomFunction #2190

Merged
merged 3 commits into from
Aug 12, 2024

Conversation

filmaj
Copy link
Contributor

@filmaj filmaj commented Aug 9, 2024

Instead of spreading the existing app-level webclient properties as options when constructing the web client, expose a getter on App to retrieve the user-provided original assembled web client options and construct a CustomFunction instance that way.

This ensures no funny business using the spread operator (like spreading readonly properties) and ensures the original user-provided web client options are honoured.

Also adds a couple of tests for CustomFunction complete/fail factory methods to increase test coverage a tad.

Should address the two remaining "in progress" List items assigned to me for Remote Functions GA.

@filmaj filmaj self-assigned this Aug 9, 2024
@filmaj filmaj marked this pull request as ready for review August 9, 2024 18:38
@filmaj filmaj changed the title WIP: Change how webclient options are constructed in CustomFunction Remote Functions: Change how webclient options are constructed in CustomFunction Aug 9, 2024
Copy link

codecov bot commented Aug 9, 2024

Codecov Report

Attention: Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 81.58%. Comparing base (d390d8f) to head (5cb0952).

Files Patch % Lines
src/App.ts 0.00% 2 Missing ⚠️
src/middleware/builtin.ts 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@
##           pre-stable-fixes    #2190      +/-   ##
====================================================
+ Coverage             80.87%   81.58%   +0.70%     
====================================================
  Files                    19       19              
  Lines                  1637     1640       +3     
  Branches                461      462       +1     
====================================================
+ Hits                   1324     1338      +14     
+ Misses                  205      194      -11     
  Partials                108      108              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@filmaj filmaj requested a review from misscoded August 9, 2024 18:42
Copy link
Contributor

@misscoded misscoded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though a question about the TS changes:

The only part that gives me pause is the swapping of never for undefined. Doesn't the usage of never signal that unless the other condition is present, that property will not exist at all? Namely, "pruning unwanted cases". undefined seems to accomplish a different end, that the property may exist but if it does, it may not have a value. Doesn't this loosen the typing?

That said, my TypeScript is rusty and you've been dealing with it much more recently, so if you feel it's the right move, happy to defer!

@filmaj
Copy link
Contributor Author

filmaj commented Aug 12, 2024

never actually means "you cannot define this property at all" - even setting it to undefined will raise a typescript compilation error. It's one among many issues in this repo today that force us to do liberal type casting (as TheTypeWeKnowWeWantButYouComplainToMeSoMuchTypeScriptThatYouForceMeToDoThis)

@filmaj filmaj merged commit 7ee465b into pre-stable-fixes Aug 12, 2024
9 checks passed
@filmaj filmaj deleted the rf-webclientoptions branch August 12, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants