From 4dedccde9f680624f9c3150900872be8d665b99e Mon Sep 17 00:00:00 2001 From: Florian Nachtigall Date: Mon, 5 Oct 2026 21:31:24 +0200 Subject: [PATCH 1/2] Fix Plotly preview cleanup crash Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/components/TypeMetricsPlot.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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]); From 18f2bcb7099fb40e494d3294c0f87475a54fd186 Mon Sep 17 00:00:00 2001 From: Florian Nachtigall Date: Mon, 5 Oct 2026 21:31:30 +0200 Subject: [PATCH 2/2] Simplify README preview deployment note Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- README.md | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) 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-/`.