rusackas opened a new pull request, #42315:
URL: https://github.com/apache/superset/pull/42315
### SUMMARY
Line charts (and every other time-axis chart) are broken on `master`,
crashing with `TypeError: Cannot read properties of null (reading '0')` while
rendering. The working theory was the echarts 6 bump (#40264), and #42314
proposes reverting it, but the crash is actually coming from our locale loading.
The locale loaders in `Echart.tsx` import echarts' `i18n/lang*.js` bundles.
Those are side-effect UMD files: they call `registerLocale` against a *second*
echarts instance (`require('echarts/lib/echarts')`) and export nothing, so
webpack's CommonJS interop hands us `.default === {}`. We then call
`registerLocale('EN', {})`, which overwrites echarts' builtin EN locale with an
empty object. The next time a time axis formats a label, echarts reads
`time.month` from that empty locale and throws. This became reachable when
#42055 pointed the dynamic import at a path that actually resolves; the old
`echarts/lib/i18n/...` path isn't in the echarts `exports` map, so the import
always failed and we silently fell back to the builtin locale.
Worth noting: reverting the bump wouldn't fix `master`. I verified echarts
5.6.0 crashes the same way once an empty EN locale is registered, so #42314
alone would leave line charts broken.
The fix:
- Import the `lang*-obj.js` variants instead. They export the locale object
itself, have no side effects, and drop the duplicated echarts lib bundle from
every locale chunk.
- Guard `registerLocale` against content-free locale objects so the builtins
can't get wiped again.
- Register `LegacyGridContainLabel`, since echarts 6 otherwise ignores
`grid.containLabel` (which most of our chart options set) and clips axis labels.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: any time-axis ECharts viz in Explore shows "An error occurred while
rendering the visualization: TypeError: Cannot read properties of null (reading
'0')". After: renders normally.
### TESTING INSTRUCTIONS
Open a Line Chart on `birth_names` (x-axis `ds`) on `master` to see the
crash, then on this branch to see it render. New unit tests in
`echartsLocale.test.ts` cover the loaders (every locale must yield real `time`
content) and render a time-axis chart end to end with the loaded EN locale
registered. I also verified line, bar, area, scatter, smooth, step, mixed
timeseries, big number w/ trendline, and pie in a browser against this branch.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]