From 2c900b003fb0a55fd5c7ad61e8468ed018e7eb9e Mon Sep 17 00:00:00 2001 From: Jared Knowles Date: Mon, 10 Aug 2026 11:44:26 -0400 Subject: [PATCH] Fix static asset paths for /crdc-demo subdirectory deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - App.jsx: Use import.meta.env.BASE_URL prefix for civilytics-logo.svg (was hardcoded as '/civilytics-logo.svg' → 404 on pages.civilytics.org/crdc-demo/) - ChartPanel.jsx: Same fix for /data/national_rates.json path — was causing JSON.parse errors because the 404 HTML response couldn't be parsed --- src/App.jsx | 2 +- src/components/ChartPanel.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index ae1c088..3fbf6e8 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -47,7 +47,7 @@ export default function App() {
Civilytics — social science for the public good { e.target.style.display = 'none' }} diff --git a/src/components/ChartPanel.jsx b/src/components/ChartPanel.jsx index a15ba8f..dd437be 100644 --- a/src/components/ChartPanel.jsx +++ b/src/components/ChartPanel.jsx @@ -23,7 +23,7 @@ export default function ChartPanel({ district, state }) { // National rates from static fixture (or cache from loading step) let nat = window.__NATIONAL_RATES__ if (!nat) { - const res = await fetch('/data/national_rates.json') + const res = await fetch(import.meta.env.BASE_URL + 'data/national_rates.json') nat = await res.json() } setNationalRates(nat)