Resumen de los cambios del fix de navegación:
Some checks failed
/ Deploy to Cloudflare Pages (push) Has been cancelled

LibraryPage.tsx:778 — reemplazó useSearch({ from: '/' }) por useRouterState + URLSearchParams. Ahora funciona tanto desde / como desde /library.
WorkspacePage.tsx:206-209 — handleBack() navega a /library (con o sin ?org=uuid) en lugar de /.
workspace-back-button.test.ts — backTo actualizado a /library y /library?org=... en los 6 tests.
library-ui.test.tsx — mock de useSearch → useRouterState (devuelve { location: { search: '' } }).
This commit is contained in:
2026-07-07 14:24:26 -03:00
parent ee356e5de6
commit f3f55a6857
5 changed files with 24 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
import { useEffect, useState, useRef, useCallback } from 'react'
import { useNavigate, useSearch } from '@tanstack/react-router'
import { useNavigate, useRouterState } from '@tanstack/react-router'
import {
Upload, Search, Plus, Building2, FolderX, GitBranch,
Clock, TrendingUp, BarChart2, FileX2, X, Settings,
@@ -775,7 +775,8 @@ export function LibraryPage() {
const navigate = useNavigate()
const { load, processes, groups, settings, isLoading } = useLibraryStore()
const { user, isProfileLoaded } = useAuth()
const { org: orgParam } = useSearch({ from: '/' }) as { org?: string }
const searchStr = useRouterState({ select: (s) => s.location.search })
const orgParam = new URLSearchParams(searchStr).get('org')
const [view, setView] = useState<'home' | 'group'>('home')
const [activeGroupId, setActiveGroupId] = useState<string | null>(null)
const [transitioning, setTransitioning] = useState(false)

View File

@@ -203,9 +203,9 @@ export function WorkspacePage() {
function handleBack() {
const orgId = currentProcess?.orgId
if (orgId && !isClientRole) {
void navigate({ to: '/', search: { org: orgId } })
void navigate({ to: '/library', search: { org: orgId } as never })
} else {
void navigate({ to: '/' })
void navigate({ to: '/library' })
}
}

View File

@@ -103,6 +103,12 @@ const indexRoute = createRoute({
component: LibraryPage,
})
const libraryRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/library',
component: LibraryPage,
})
const importRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/import',
@@ -170,6 +176,7 @@ const routeTree = rootRoute.addChildren([
resetPasswordRoute,
confirmInviteRoute,
indexRoute,
libraryRoute,
importRoute,
workspaceRoute,
reportRoute,