diff --git a/README.md b/README.md index 40d5e96..618edad 100644 --- a/README.md +++ b/README.md @@ -40,18 +40,4 @@ For full production setup (Traefik + DNS + Plausible CE + maintenance), see [PRO ### Notes - Linting: `npm run lint`. - If the map on the landing page does not render, ensure WebGL is available/enabled in your browser. - -## PR preview deployments - -This repository includes a GitHub Actions workflow (`.github/workflows/pr-preview.yml`) that: -- triggers on PR `opened`, `synchronize`, and `reopened`; -- builds the app with `npm ci` and `npm run build`; -- deploys the built `dist/` to `gh-pages` under `pr-/`; -- creates or updates a PR comment with the preview URL; -- on PR close, updates that comment to mark the preview as no longer maintained (lightweight cleanup). - -Expected preview URL format: -`https://.github.io//pr-/` - -Repository setting required once: -- **Settings → Pages**: source must be the `gh-pages` branch (root folder). +- PR website preview builds are deployed automatically via GitHub Actions at `https://ai4up.github.io/cities-learning-explorer/pr-/`. diff --git a/src/components/TypeMetricsPlot.jsx b/src/components/TypeMetricsPlot.jsx index 457e0a1..aa09828 100644 --- a/src/components/TypeMetricsPlot.jsx +++ b/src/components/TypeMetricsPlot.jsx @@ -147,17 +147,25 @@ const TypeMetricsPlot = ({ cities, activeType }) => { }; }); - Plotly.newPlot(plotRef.current, traces, layout, { + const plotElement = plotRef.current; + + Plotly.newPlot(plotElement, traces, layout, { displayModeBar: false, responsive: true, }); - const resize = () => Plotly.Plots.resize(plotRef.current); + const resize = () => { + if (plotElement) { + Plotly.Plots.resize(plotElement); + } + }; window.addEventListener("resize", resize); return () => { window.removeEventListener("resize", resize); - Plotly.purge(plotRef.current); + if (plotElement) { + Plotly.purge(plotElement); + } }; }, [cities, activeType]);