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 maximum call stack size exceeded on Math.min/max when creating Charts #6958

Merged
merged 5 commits into from
Nov 13, 2023

Conversation

nf-s
Copy link
Contributor

@nf-s nf-s commented Nov 2, 2023

What this PR does

Fixes #6941

I also sneaked in a fix for MyDataTab showing a number.

image

Test me

Make sure you test in Chrome (Firefox never had this issue)

  • Before link
  • After link
  • Select "Region Type" = "Statistical Area Level 4"
  • Select "Region Type" = "Statistical Area Level 2"
  • Select "Region Type" = "Statistical Area Level 4" again
  • It doesn't crash now
  • Also go to "Upload" and see if there are "0"s on the screen

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

@nf-s nf-s requested a review from ljowen November 2, 2023 10:12
@nf-s nf-s mentioned this pull request Nov 3, 2023
lib/Core/math.ts Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we just use Math.min? This method will be faster but I assume calculateDomain get's called only once per series

Copy link
Contributor Author

@nf-s nf-s Nov 13, 2023

Choose a reason for hiding this comment

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

Do you mean using Math.min instead of getMin?
Or using Math.min instead of min = nums[len] < min ? nums[len] : min;

We can't use Math.min instead of getMin because of the spread operator in calculateDomain

Copy link
Contributor

Choose a reason for hiding this comment

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

Aha! sorry I missed the actual root cause!

lib/ReactViews/ExplorerWindow/Tabs/MyDataTab/MyDataTab.jsx Outdated Show resolved Hide resolved
@nf-s nf-s merged commit c6e0d51 into main Nov 13, 2023
6 checks passed
@nf-s nf-s deleted the minmax-exceed-stack branch November 13, 2023 06:11
@nf-s nf-s mentioned this pull request Nov 15, 2023
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.

Bug: Callstack exceeded in CalculateDomain when switching region aggregation
2 participants