From 2882a7737b63e0f6e4b90b26d7eef2075e1ec796 Mon Sep 17 00:00:00 2001 From: DEV-bot Date: Sun, 1 Mar 2026 10:42:09 +0000 Subject: [PATCH] feat(spa): add top-level app-shell error boundary recover actions (#151) --- lobby/templates/lobby/host_screen.html | 18 +++++++++++++++--- lobby/templates/lobby/player_screen.html | 20 ++++++++++++++++++-- lobby/tests.py | 16 ++++++++++++++++ 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/lobby/templates/lobby/host_screen.html b/lobby/templates/lobby/host_screen.html index 096385e..8af0a39 100644 --- a/lobby/templates/lobby/host_screen.html +++ b/lobby/templates/lobby/host_screen.html @@ -28,6 +28,10 @@

Auto-refresh er slået fra.

Session-data ikke opdateret endnu.

+
Klar.
diff --git a/lobby/templates/lobby/player_screen.html b/lobby/templates/lobby/player_screen.html index e66f661..7d8fddf 100644 --- a/lobby/templates/lobby/player_screen.html +++ b/lobby/templates/lobby/player_screen.html @@ -12,6 +12,9 @@ #connectionBanner { margin: 8px 0 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid #b91c1c; background: #fee2e2; color: #7f1d1d; display: none; } #connectionBanner button { margin-left: 8px; border: 1px solid #991b1b; background: #fff; color: #7f1d1d; border-radius: 6px; padding: 4px 8px; cursor: pointer; } #connectionBanner button[disabled] { opacity: 0.55; cursor: not-allowed; } +#playerShellErrorBoundary { margin: 8px 0 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid #b91c1c; background: #fee2e2; color: #7f1d1d; display: none; } +#playerShellErrorBoundary button { margin-left: 8px; border: 1px solid #991b1b; background: #fff; color: #7f1d1d; border-radius: 6px; padding: 4px 8px; cursor: pointer; } +#playerShellErrorBoundary button[disabled] { opacity: 0.55; cursor: not-allowed; } #lieStatus.locked { color: #0a5f2d; font-weight: 600; } #guessStatus.locked { color: #0a5f2d; font-weight: 600; } @@ -42,6 +45,10 @@

Fase: ukendt (opdatér session-status).

Ingen fejl.

Forbindelsen til serveren blev afbrudt.
+
Der opstod en kritisk fejl i app-skallen. + + +
Klar.
diff --git a/lobby/tests.py b/lobby/tests.py index 81dc680..e000eaf 100644 --- a/lobby/tests.py +++ b/lobby/tests.py @@ -869,6 +869,14 @@ class UiScreenTests(TestCase): self.assertContains(response, "hostShellRouteFromPath") self.assertContains(response, "syncHostShellRoute") self.assertContains(response, "Deep-link route guard: omdirigeret") + self.assertContains(response, "id=\"hostShellErrorBoundary\"") + self.assertContains(response, "recoverHostShell('retry')") + self.assertContains(response, "recoverHostShell('reload')") + self.assertContains(response, "setHostShellFatalError") + self.assertContains(response, "clearHostShellFatalError") + self.assertContains(response, "updateHostShellErrorBoundary") + self.assertContains(response, "host_shell_runtime_error") + self.assertContains(response, "window.addEventListener(\"unhandledrejection\"") def test_host_screen_deeplink_requires_login(self): response = self.client.get(reverse("lobby:host_screen_deeplink", kwargs={"spa_path": "guess"})) @@ -956,6 +964,14 @@ class UiScreenTests(TestCase): self.assertContains(response, "Session-data ikke opdateret endnu.") self.assertContains(response, "Sidst opdateret:") self.assertContains(response, "Session-data kan være forældet") + self.assertContains(response, "id=\"playerShellErrorBoundary\"") + self.assertContains(response, "recoverPlayerShell('retry')") + self.assertContains(response, "recoverPlayerShell('reload')") + self.assertContains(response, "setPlayerShellFatalError") + self.assertContains(response, "clearPlayerShellFatalError") + self.assertContains(response, "updatePlayerShellErrorBoundary") + self.assertContains(response, "player_shell_runtime_error") + self.assertContains(response, "window.addEventListener(\"error\"") class SessionDetailRoundQuestionTests(TestCase):