-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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 rendering regression from the introduction of bignumber #6937
Conversation
In superset-ui 0.8.0, we used bignumber.js to transform numbers in chartProps' payload from plain 64-bit floats to BigNumber instances. This causes a number of charts to render incorrectly when comparison functions in the rendering algorithms operate on BigNumber objects instead of floats. This PR uses the preTransformProps step in SuperChart to transform BigNumber instances back to floats so charts can render properly.
Codecov Report
@@ Coverage Diff @@
## master #6937 +/- ##
==========================================
+ Coverage 63.98% 63.99% +<.01%
==========================================
Files 422 423 +1
Lines 20537 20555 +18
Branches 2230 2235 +5
==========================================
+ Hits 13141 13154 +13
- Misses 7264 7269 +5
Partials 132 132
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// floats instead of BigNumber instances in their props to properly render. | ||
import BigNumber from 'bignumber.js'; | ||
|
||
export default function transform(payload) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transformBigNumber
? there's a lint rule for this we should enable.
payload[key] = transform(payload[key]); | ||
} | ||
} | ||
} else if (payload.constructor === Array) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Array.isArray
is preferred
In superset-ui 0.8.0, we used bignumber.js to transform numbers in chartProps' payload from plain 64-bit floats to BigNumber instances. This causes a number of charts to render incorrectly when comparison functions in the rendering algorithms operate on BigNumber objects instead of floats. This PR uses the preTransformProps step in SuperChart to transform BigNumber instances back to floats so charts can render properly. (cherry picked from commit 73cdb37)
I'm a bit concerned about recursing through all payloads looking for How do BigNumber come to life first, any way handle it there? |
Revert "Fix rendering regression from the introduction of bignumber (apache#6937)"
…bignumber.js change to SQL editor in an opt-in fashion (#7210) * revert: bignumber patch to prevent rendering regression in charts * Revert "Fix rendering regression from the introduction of bignumber (#6937)" * fix: consume the bignumber.js reversion -- apply the bignumber conversion in `actions/sqlLab.js` where it is needed (aka opt into bignumber.js). * Revert "Fix deck.gl form data (#6953)" b/c formData now returns snake_cased properties for deck vizzes.
In superset-ui 0.8.0, we used bignumber.js to transform numbers in chartProps' payload from plain 64-bit floats to BigNumber instances. This causes a number of charts to render incorrectly when comparison functions in the rendering algorithms operate on BigNumber objects instead of floats. This PR uses the preTransformProps step in SuperChart to transform BigNumber instances back to floats so charts can render properly.
cc @soboko