Fix menu link click error and charts failing after the JSON editor #14

Merged
clayschaad merged 1 commit from fix-navlink-and-chart-loading into main 2026-10-30 21:21:11 +00:00
Owner

Two front-end fixes.

Every click on a menu link threw Cannot read properties of null (reading 'click'). FluentNavMenu had CustomToggle="true" (left over from the project template), which makes every FluentNavLink run document.getElementById('navmenu-toggle').click(), but the app has no such element. Removed it; the ☰ button is Fluent's own collapse button and is unaffected.

Charts failing after the JSON editor

Opening Analyse (also Strom, Wasser) after the JSON editor without a full reload failed with Cannot read properties of undefined (reading 'defaults') and terminated the circuit. Monaco's AMD loader leaves a global define(); Chart.js and the treemap plugin are UMD bundles that then register as AMD modules instead of setting window.Chart.
charts.js now hides define while loading them (the same thing Plotly.Blazor's loader does), through one shared loading promise so concurrently created charts can't restore it wrongly. CLAUDE.md note added.

Testing (Playwright/Chrome against a second app instance, real data, no saves)

  • Menu: links with inline onclick 16 → 0, page errors on link clicks 3 → 0 (wide and narrow); collapse button and auto-collapse below 700px unchanged
  • Charts: Analyse/Strom/Wasser after the JSON editor: before 0 charts drawn + circuit terminated, after all drawn, no errors; chart page → JSON editor → Strom: editor styled and charts drawn
  • JSON editor checks from #13 still pass; dotnet test 160 passed

🤖 Generated with Claude Code

Two front-end fixes. ## Menu link click error Every click on a menu link threw `Cannot read properties of null (reading 'click')`. `FluentNavMenu` had `CustomToggle="true"` (left over from the project template), which makes every `FluentNavLink` run `document.getElementById('navmenu-toggle').click()`, but the app has no such element. Removed it; the ☰ button is Fluent's own collapse button and is unaffected. ## Charts failing after the JSON editor Opening Analyse (also Strom, Wasser) after the JSON editor without a full reload failed with `Cannot read properties of undefined (reading 'defaults')` and terminated the circuit. Monaco's AMD loader leaves a global `define()`; Chart.js and the treemap plugin are UMD bundles that then register as AMD modules instead of setting `window.Chart`. `charts.js` now hides `define` while loading them (the same thing Plotly.Blazor's loader does), through one shared loading promise so concurrently created charts can't restore it wrongly. CLAUDE.md note added. ## Testing (Playwright/Chrome against a second app instance, real data, no saves) - Menu: links with inline onclick 16 → 0, page errors on link clicks 3 → 0 (wide and narrow); collapse button and auto-collapse below 700px unchanged - Charts: Analyse/Strom/Wasser after the JSON editor: before 0 charts drawn + circuit terminated, after all drawn, no errors; chart page → JSON editor → Strom: editor styled and charts drawn - JSON editor checks from #13 still pass; `dotnet test` 160 passed 🤖 Generated with [Claude Code](https://claude.com/claude-code)
clayschaad added 1 commit 2026-10-30 21:21:10 +00:00
- NavMenu: drop CustomToggle="true" (left over from the project
  template). It made every nav link run
  document.getElementById('navmenu-toggle').click(), but there is no
  such element, so each click threw a TypeError.
- charts.js: Monaco's AMD loader (JSON editor) leaves a global define()
  and pages switch without a full reload. Chart.js and the treemap plugin
  are UMD bundles that then register as AMD modules instead of setting
  window.Chart, so Analyse, Strom and Wasser failed with "Cannot read
  properties of undefined (reading 'defaults')" and the circuit was
  terminated. define is now hidden while they load, through one shared
  loading promise so concurrent charts can't restore it wrongly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clayschaad merged commit cde16d2d0f into main 2026-10-30 21:21:11 +00:00
clayschaad deleted branch fix-navlink-and-chart-loading 2026-10-30 21:21:11 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: clayschaad/AccountingNext#14
No description provided.