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(legacy-charts): fix render multiple charts at one page #803
Conversation
size-limit report 📦
|
legacy/src/Charts.js
Outdated
export function generateChart(chartId, chartType, chartController) { | ||
let _chart = null | ||
let _store = null |
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.
it looks like "ref", so then maybe just
let _chartRef = { current: null }
...
_chartRef.current
?
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.
@dangreen, I checked, and your solution doesn't fix this bug.
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.
ok, here just let _chartRef = null
_store = new ComponentStore()
-> _chartRef = { current: null }
_store.setComponentChart(...)
-> _chartRef.current = ...
etc
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.
It works. I used it.
835e8f8
to
feb93d7
Compare
legacy/src/Charts.js
Outdated
_chartRef !== null && | ||
'current' in _chartRef && | ||
_chartRef.current !== null |
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.
_chartRef !== null && | |
'current' in _chartRef && | |
_chartRef.current !== null | |
_chartRef?.current |
?
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.
used
legacy/src/Charts.js
Outdated
_chartRef !== null && | ||
'current' in _chartRef |
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.
...
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.
removed
Fix or Enhancement?
fix the error, when multiple charts can't render on one page
from issues #800 #801
Environment