From 39b15af5b0b152035feb1fda72b404c289737e50 Mon Sep 17 00:00:00 2001 From: Colin Dawson Date: Tue, 17 Mar 2026 21:09:32 +0000 Subject: [PATCH] Fixed the sso auto login with the htmlisland, and also fixed the extremely slow page reloads in development mode. --- package.json | 2 +- src/components/common/HtmlIsland.tsx | 11 +++++++++++ vite.config.ts | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ad2f50b..ae6e2cf 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "devDependencies": { "@types/node": "^25.3.0", "@types/react-toggle": "^4.0.5", - "@vitejs/plugin-react": "^5.1.4", + "@vitejs/plugin-react-swc": "^4.3.0", "i18n-unused": "^0.19.0", "typescript": "^5.9.3", "vite": "^7.3.1" diff --git a/src/components/common/HtmlIsland.tsx b/src/components/common/HtmlIsland.tsx index 1bb69a4..0129f59 100644 --- a/src/components/common/HtmlIsland.tsx +++ b/src/components/common/HtmlIsland.tsx @@ -31,6 +31,17 @@ const HtmlIsland: React.FC = ({ ): Promise => { try { const r = await fetch(url, { credentials: "include" }); + const contentType = r.headers.get("Content-Type") ?? ""; + + if (contentType.includes("application/json")) { + const json = await r.json(); + + if (json.redirectTo) { + window.location.assign(json.redirectTo); + return ""; + } + } + if (!r.ok) throw new Error(`Failed to load island: ${r.status}`); return await r.text(); } catch (err) { diff --git a/vite.config.ts b/vite.config.ts index a25bb64..77e2396 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "vite"; -import react from "@vitejs/plugin-react"; +import react from "@vitejs/plugin-react-swc"; export default defineConfig({ plugins: [react()],