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

fix(recommend): prevent undefined threshold #1300

Merged
merged 2 commits into from Aug 25, 2021

Conversation

shortcuts
Copy link
Member

Summary

Sending threshold: undefined to the API client causes the default value (0) to be overridden.

sandbox reproduction

Result

The default value isn't overridden when sending threshold: undefined

Copy link
Member

@francoischalifour francoischalifour left a comment

Choose a reason for hiding this comment

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

Can we add a test with a value for threshold?

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 25, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3007cb4:

Sandbox Source
javascript-client-app Configuration
dreamy-cherry-qggh0 PR

Copy link
Member

@francoischalifour francoischalifour left a comment

Choose a reason for hiding this comment

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

Thank you!

@Haroenv
Copy link
Contributor

Haroenv commented Aug 25, 2021

What sets the threshold to undefined instead of nothing?

@shortcuts
Copy link
Member Author

What sets the threshold to undefined instead of nothing?

Not sure if that's what you asked, but defaulted props in the recommend UI library for example, or if you send threshold: undefined to the client

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

decent solution, what we probably were more looking for here is lodash.defaults instead of Object.assign, but it's not that big of a deal

@Haroenv Haroenv merged commit 7d21d3c into master Aug 25, 2021
@Haroenv Haroenv deleted the fix/recommend-default-threshold branch August 25, 2021 15:25
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.

None yet

3 participants