Fix dashboard initialization failures due to missing dependencies#88
Fix dashboard initialization failures due to missing dependencies#88
Conversation
…rrors Co-authored-by: pethers <[email protected]>
…adapter) Co-authored-by: pethers <[email protected]>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
There was a problem hiding this comment.
Pull request overview
This PR fixes dashboard runtime initialization errors on the static site by vendoring and loading missing client-side JavaScript dependencies (CSV parsing and Chart.js time adapter), and documenting the updated dependency set.
Changes:
- Added locally hosted third-party libraries: Papa Parse (CSV parsing) and chartjs-adapter-date-fns (Chart.js time scale support).
- Updated
index.htmland all language variants to include the missing libraries in the correct load order before dashboard scripts. - Updated security and architecture documentation to reflect the expanded locally hosted dependency set.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| js/lib/papaparse.5.5.3.min.js | Adds vendored Papa Parse library required by dashboards parsing CSV. |
| js/lib/chartjs-adapter-date-fns.3.0.0.bundle.min.js | Adds vendored Chart.js date-fns adapter required for time-series charts. |
| index.html | Loads the new adapter + Papa Parse before dashboard modules to prevent runtime init failures. |
| index_sv.html | Adds local D3/Chart/annotation/adapter/Papa script tags before the coalition dashboard module. |
| index_da.html | Same dependency script additions as other language variants. |
| index_no.html | Same dependency script additions as other language variants. |
| index_fi.html | Same dependency script additions as other language variants. |
| index_de.html | Same dependency script additions as other language variants. |
| index_fr.html | Same dependency script additions as other language variants. |
| index_es.html | Same dependency script additions as other language variants. |
| index_nl.html | Same dependency script additions as other language variants. |
| index_ar.html | Same dependency script additions as other language variants (RTL page). |
| index_he.html | Same dependency script additions as other language variants (RTL page). |
| index_ja.html | Same dependency script additions as other language variants. |
| index_ko.html | Same dependency script additions as other language variants. |
| index_zh.html | Same dependency script additions as other language variants. |
| SECURITY_ARCHITECTURE.md | Documents the added locally hosted dependencies and dependency management list. |
| ARCHITECTURE.md | Updates architecture docs to include the new libraries in stack/diagrams/risk table. |
| - **External Dependencies:** | ||
| - Chart.js v4.4.1 (hosted locally on CloudFront/S3 at js/lib/chart.umd.4.4.1.js) | ||
| - chartjs-plugin-annotation v3.0.1 (hosted locally on CloudFront/S3 at js/lib/chartjs-plugin-annotation.3.0.1.min.js) | ||
| - chartjs-adapter-date-fns v3.0.0 bundle (hosted locally on CloudFront/S3 at js/lib/chartjs-adapter-date-fns.3.0.0.bundle.min.js) - for time-series charts | ||
| - D3.js v7.9.0 (hosted locally on CloudFront/S3 at js/lib/d3.7.9.0.min.js) | ||
| - Papa Parse v5.5.3 (hosted locally on CloudFront/S3 at js/lib/papaparse.5.5.3.min.js) - for CSV parsing |
There was a problem hiding this comment.
The earlier CSP note in this section (around line ~237) still says only Chart.js, D3.js, and chartjs-plugin-annotation are locally hosted. Since this PR adds chartjs-adapter-date-fns and Papa Parse as additional locally hosted dependencies, that note should be updated to include them to avoid documentation drift/inconsistency within the same section.
Three dashboards (committees, coalition, election-cycle) failed to initialize with
ReferenceError: Papa is not definedandError: This method is not implemented: Check that a complete date adapter is provided.Changes
Added missing dependencies (69KB, locally hosted):
papaparse.5.5.3.min.js(19KB) - CSV parsing for data ingestionchartjs-adapter-date-fns.3.0.0.bundle.min.js(50KB) - Chart.js time-series supportUpdated HTML (15 files):
index.html+ 13 language variants with library script tagsUpdated documentation:
SECURITY_ARCHITECTURE.md- External dependencies list and risk tableARCHITECTURE.md- Technology stack and dependency diagramLibrary loading order
Result
Zero dashboard initialization errors. CSV parsing and time-series charts functional.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
download.cypress.io/opt/hostedtoolcache/node/24.13.0/x64/bin/node node dist/index.js --exec install(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.