From 0bef3202f3393ed35bddb7278d51f95ec314fcba Mon Sep 17 00:00:00 2001
From: Kasper Fabricius Kristensen
<45367945+kasperkristensen@users.noreply.github.com>
Date: Wed, 22 Jan 2025 13:47:17 +0100
Subject: [PATCH] fix(dashboard): Add global errorElement (#10981)
Resolves CMRC-627
**What**
- If the session expired, and the user then navigated to a route with no loader the request for the user info in the sidebar would fail causing the app to crash as we didn't have an errorElement wrapping the app shell.
- This PR adds a top level errorElement which handles errors that are outside of a page context, such as in the sidebar.
---
.changeset/tasty-plums-tan.md | 5 +++++
.../dashboard/src/providers/router-provider/route-map.tsx | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
create mode 100644 .changeset/tasty-plums-tan.md
diff --git a/.changeset/tasty-plums-tan.md b/.changeset/tasty-plums-tan.md
new file mode 100644
index 0000000000..50f5d4771c
--- /dev/null
+++ b/.changeset/tasty-plums-tan.md
@@ -0,0 +1,5 @@
+---
+"@medusajs/dashboard": patch
+---
+
+fix(dashboard): Add global errorElement
diff --git a/packages/admin/dashboard/src/providers/router-provider/route-map.tsx b/packages/admin/dashboard/src/providers/router-provider/route-map.tsx
index 0d47e75cbc..b00688df4b 100644
--- a/packages/admin/dashboard/src/providers/router-provider/route-map.tsx
+++ b/packages/admin/dashboard/src/providers/router-provider/route-map.tsx
@@ -12,10 +12,10 @@ import { taxRegionLoader } from "../../routes/tax-regions/tax-region-detail/load
import { RouteExtensions } from "./route-extensions"
import { SettingsExtensions } from "./settings-extensions"
-// TODO: Add translations for all breadcrumbs
export const RouteMap: RouteObject[] = [
{
element: ,
+ errorElement: ,
children: [
{
element: ,