chore(deps): upgrade D3 v5 → v7 - #8539
Open
tim2000s wants to merge 17 commits into
Open
Conversation
Master update
Update master
Update of NS
Update to 13.0.0
LAtest PR
UPdate to latest
Update local copy
Update to NS15
Bumps d3 from ^5.16.0 to ^7.9.0 and migrates all client D3 usage to the v7 API: the d3.event global was removed in v6, so every selection/brush/drag event handler now takes (event, datum); d3.mouse(node) -> d3.pointer(event, node) with touch-event unwrapping in the focus/context brush. Affects chart.js, renderer.js and the day-to-day report. No behavioural change to the charts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
📦 Part of a 4-PR UI-modernization seriesTo keep review manageable, this work is split into four focused PRs rather than one large diff. Suggested review/merge order:
#8540 and #8541 are independent of #8539/#8542 and of each other (they touch different lines of the one shared file), so they can be reviewed in any order. Merging all four reproduces the same tree, verified locally. Happy to reshape any of these (e.g. make the theme opt-in, gate the reports auto-load, or drop the websocket change) based on your preferences. 🤖 Generated with Claude Code |
d3 v7's package entry is ESM-only, so the test fixture's require('d3') threw
"Unexpected token 'export'" under Node's CommonJS require on Node 20/22/24
(it only worked locally on Node 25, which supports require(esm)). The webpack
bundle the harness already loads exposes a working window.d3, so reuse that
instead of requiring d3 from node_modules. Fixes CI for the D3 v7 upgrade.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
admintools.test.js has its own benv setup (separate from the headless fixture)
with its own require('d3'), which hits d3 v7's ESM-only entry and fails under
Node < 25. Reuse the window.d3 the bundle (loaded just above) already exposes,
matching the headless fixture fix.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
chore(deps): upgrade D3 v5 → v7
Bumps
d3from^5.16.0to^7.9.0and migrates all client-side D3 usage to the v7 API.Why
D3 v5 is six years old. Subsequent UI/report work (a new ambulatory-glucose-profile report, retiring the abandoned Flot charting library) needs v7. This PR is intentionally standalone and behaviour-neutral so it can land first and de-risk the rest of the series.
What changed
D3 v6 removed the
d3.eventglobal, so the migration is mechanical but wide:selection.on(...), brush, and drag handler now receives(event, datum)instead of reading thed3.eventglobal.d3.mouse(node)→d3.pointer(event, node), with touch-event unwrapping in the focus/context brush.Affected files:
lib/client/chart.js,lib/client/renderer.js, andlib/report_plugins/daytoday.js(plus thepackage.json/lockfile bump).Testing
client.rendererintegration test passes.Series
This is part 1 of a 4-PR UI-modernization series; the others build on it (reports/AGP) or are independent (theme, platform). Recommend landing this one first.
🤖 Generated with Claude Code