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(ellipticalROI): give default values for cachedStats values to avoid undefined error #1537

Merged

Conversation

md-prog
Copy link
Contributor

@md-prog md-prog commented Mar 27, 2023

  • Please check if the PR fulfills these requirements
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Bug Fix:
_createTextBoxContent() function call during rendering sometimes causes undefined error.

  • What is the current behavior? (You can also link to an open issue here)

Ideal flow would have been, first calculate all values of cachedStats and then call the _createTextBoxContent() function.
But in reality, particularly for the initial load, the _createTextBoxContent() function is called before the cachedStats values are calculated.

  • What is the new behavior (if this is a feature change)?

Gave default value: 0, for the cachedStats values that are being used by _createTextBoxContent().
This will prevent undefined error until they are correctly caculcated.

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No

  • Other information:

@codecov
Copy link

codecov bot commented Mar 27, 2023

Codecov Report

Merging #1537 (0ada1b7) into master (925a3dd) will increase coverage by 1.22%.
The diff coverage is 58.82%.

❗ Current head 0ada1b7 differs from pull request most recent head d675825. Consider uploading reports for the commit d675825 to get more accurate results

@@            Coverage Diff             @@
##           master    #1537      +/-   ##
==========================================
+ Coverage   21.70%   22.92%   +1.22%     
==========================================
  Files         287      288       +1     
  Lines       10137    10070      -67     
  Branches     2081     2053      -28     
==========================================
+ Hits         2200     2309     +109     
+ Misses       6750     6611     -139     
+ Partials     1187     1150      -37     
Impacted Files Coverage Δ
src/tools/annotation/_utils.js 48.14% <48.14%> (ø)
src/tools/annotation/CircleRoiTool.js 88.79% <100.00%> (+10.94%) ⬆️
src/tools/annotation/EllipticalRoiTool.js 75.92% <100.00%> (+42.59%) ⬆️
src/tools/annotation/RectangleRoiTool.js 84.00% <100.00%> (+40.60%) ⬆️

... and 6 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ladeirarodolfo ladeirarodolfo self-requested a review March 27, 2023 18:17
Copy link
Contributor

@ladeirarodolfo ladeirarodolfo left a comment

Choose a reason for hiding this comment

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

LGTM

@md-prog md-prog force-pushed the bugfix/undefined_in_createTextBoxContent branch from 0ada1b7 to d675825 Compare March 27, 2023 19:45
@sedghi sedghi changed the title [bugfix] give default values for cachedStats values to avoid undefined error fix(ellipticalROI): give default values for cachedStats values to avoid undefined error Mar 27, 2023
@sedghi sedghi merged commit 79d0ee1 into cornerstonejs:master Mar 27, 2023
@sedghi
Copy link
Member

sedghi commented Mar 27, 2023

🎉 This PR is included in version 6.0.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants