From 859e16c2be741598362d4872ea12e9f395943a6d Mon Sep 17 00:00:00 2001 From: Marshal Date: Thu, 25 Jun 2026 07:35:07 +0000 Subject: [PATCH] enhance onNavigate prop to accept options for navigation state --- .../portal/src/components/AppLayout.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/edr-freight-web/portal/src/components/AppLayout.tsx b/apps/edr-freight-web/portal/src/components/AppLayout.tsx index 761f59e08..ac7c8e092 100644 --- a/apps/edr-freight-web/portal/src/components/AppLayout.tsx +++ b/apps/edr-freight-web/portal/src/components/AppLayout.tsx @@ -53,7 +53,12 @@ export interface AppLayoutProps { title?: string; sidebarItems: SidebarItem[]; activeHref?: string; - onNavigate?: (href: string) => void; + /** + * Navigate to a route. Accepts an optional options object (e.g. `{ state }`) + * forwarded to the router — used to pass navigation state like `fresh: true` + * to the new-booking wizard. Compatible with react-router's `navigate`. + */ + onNavigate?: (href: string, options?: { state?: unknown }) => void; enableThemeToggle?: boolean; userName?: string; userEmail?: string; @@ -157,7 +162,8 @@ export function AppLayout({ const primaryDarkColor = theme.colors["edr-green"][7]; const activePath = activeHref.toLowerCase(); - const navigate = (href: string) => onNavigate?.(href); + const navigate = (href: string, options?: { state?: unknown }) => + onNavigate?.(href, options); const toggleTheme = () => { setColorScheme(computedColorScheme === "dark" ? "light" : "dark");