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(trimScale): check for zero value in countTrailingZeros #448

Merged
merged 7 commits into from Nov 27, 2021
Merged

fix(trimScale): check for zero value in countTrailingZeros #448

merged 7 commits into from Nov 27, 2021

Conversation

reckter
Copy link
Contributor

@reckter reckter commented Oct 19, 2021

trimSccale, when called with a 0 as the amount, kept in a endless loop.

Cause:
countTrailingZeros was stuck, as there never was any non-zero value to brake the loop.

I am unsure wether this is the cleanest solution, but it at least fixes the problem.

Also added a quick test for regression.

@vercel
Copy link

vercel bot commented Oct 19, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/dinerojs/dinerojs/CNkH93MJzLqQHnNKEEdUPtqGxWYa
✅ Preview: https://dinerojs-git-fork-opencreek-fix-trim-scale-zero-amount-dinerojs.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 19, 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 e02ec1b:

Sandbox Source
@dinero.js/example-cart-react Configuration
@dinero.js/example-cart-vue Configuration
@dinero.js/example-pricing-react Configuration
@dinero.js/example-starter Configuration

@sarahdayan
Copy link
Collaborator

Thank you @reckter, I haven't had the time to look into your PR, I will do it this week end.

Copy link
Collaborator

@sarahdayan sarahdayan left a comment

Choose a reason for hiding this comment

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

Thanks @reckter, good catch! Let me know if you need further help.

packages/core/src/utils/countTrailingZeros.ts Outdated Show resolved Hide resolved
packages/core/src/api/__tests__/trimScale.ts Outdated Show resolved Hide resolved
packages/core/src/api/__tests__/trimScale.ts Outdated Show resolved Hide resolved
packages/core/src/utils/countTrailingZeros.ts Outdated Show resolved Hide resolved
@reckter
Copy link
Contributor Author

reckter commented Nov 10, 2021

@sarahdayan I left the comments "unresolved", as I wasn't sure how you handle these on PR's here. I've should've fixed all of them, so feel free to resolve them :)

@reckter
Copy link
Contributor Author

reckter commented Nov 27, 2021

Hey, is there anything I can do to help get this merged? :)

Copy link
Collaborator

@sarahdayan sarahdayan left a comment

Choose a reason for hiding this comment

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

We're good to go! Thanks @reckter I'll deploy this soon.

@sarahdayan sarahdayan merged commit 6eefe8b into dinerojs:main Nov 27, 2021
@reckter reckter deleted the fix-trim-scale-zero-amount branch December 1, 2021 07:55
@svarlet
Copy link

svarlet commented Oct 26, 2022

@sarahdayan or any other maintainer, can you please trigger the release pipeline?

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