diff --git a/src/features/workspace/WorkspacePage.tsx b/src/features/workspace/WorkspacePage.tsx index 2688a4b..498319d 100644 --- a/src/features/workspace/WorkspacePage.tsx +++ b/src/features/workspace/WorkspacePage.tsx @@ -192,8 +192,10 @@ export function WorkspacePage() { : currentProcess.orgName ?? 'Biblioteca' function handleBack() { - // Navega siempre a /library (sin ?org=) hasta que exista una vista filtrada por org - void navigate({ to: '/library' }) + void navigate({ + to: '/library', + search: { org: currentProcess?.orgId ?? undefined }, + }) } // Label del tab "elemento" segĂșn lo seleccionado diff --git a/src/router.tsx b/src/router.tsx index 1b821f1..45d012f 100644 --- a/src/router.tsx +++ b/src/router.tsx @@ -107,6 +107,9 @@ const libraryRoute = createRoute({ getParentRoute: () => rootRoute, path: '/library', component: LibraryPage, + validateSearch: (search: Record) => ({ + org: typeof search.org === 'string' ? search.org : undefined, + }), }) const importRoute = createRoute({ @@ -134,7 +137,7 @@ const settingsRoute = createRoute({ beforeLoad: ({ context }) => { const role = (context as { auth?: { user?: { platformRole?: string } } }).auth?.user?.platformRole if (role === 'client_editor' || role === 'client_viewer') { - throw redirect({ to: '/library' }) + throw redirect({ to: '/library', search: { org: undefined } }) } }, })