Skip to content

chore(deps): upgrade D3 v5 → v7 - #8539

Open
tim2000s wants to merge 17 commits into
nightscout:masterfrom
tim2000s:pr/d3-v7
Open

chore(deps): upgrade D3 v5 → v7#8539
tim2000s wants to merge 17 commits into
nightscout:masterfrom
tim2000s:pr/d3-v7

Conversation

@tim2000s

Copy link
Copy Markdown

chore(deps): upgrade D3 v5 → v7

Bumps d3 from ^5.16.0 to ^7.9.0 and 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.event global, so the migration is mechanical but wide:

  • Every selection.on(...), brush, and drag handler now receives (event, datum) instead of reading the d3.event global.
  • 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, and lib/report_plugins/daytoday.js (plus the package.json/lockfile bump).

Testing

  • client.renderer integration test passes.
  • Production webpack bundle builds.
  • No visual or behavioural change to the charts.

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

tim2000s and others added 15 commits February 15, 2018 08:55
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>
@tim2000s

Copy link
Copy Markdown
Author

📦 Part of a 4-PR UI-modernization series

To keep review manageable, this work is split into four focused PRs rather than one large diff. Suggested review/merge order:

  1. chore(deps): upgrade D3 v5 → v7 #8539 — chore(deps): upgrade D3 v5 → v7 (this PR) — foundational, behaviour-neutral. Land first.
  2. feat(reports): Statistics Summary (AGP) + modern report charts #8542 — feat(reports): Statistics Summary (AGP) + modern report charts — depends on chore(deps): upgrade D3 v5 → v7 #8539 (currently draft; will rebase once chore(deps): upgrade D3 v5 → v7 #8539 merges).
  3. feat(ui): Trio dark theme, 7-day TIR widget, accessibility #8540 — feat(ui): Trio dark theme, 7-day TIR widget, accessibility — independent.
  4. chore(platform): modern browser targets + websocket upgrade #8541 — chore(platform): modern browser targets + websocket upgrade — independent; contains two deliberate policy decisions (dropping very old browser support, re-enabling the websocket upgrade) flagged for maintainer sign-off.

#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

tim2000s and others added 2 commits June 16, 2026 13:59
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>
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.

1 participant