Masked navigation drops the first character of the hash each time (__tempLocation hash missing '#')
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript
- Área
- frontend
Línea de trabajo
El error está en commitLocation, donde __tempLocation se construye a partir de la ubicación lógica sin un # inicial, y en parseLocation, que lo lee de nuevo con hash.slice(1). Empieza reproduciéndolo con el script independiente del issue (historial en memoria, navegación enmascarada con un hash) y confirma que el hash se acorta un carácter por cada navegación. Está terminado cuando el hash lógico se mantiene como "anchor" tras navegaciones repetidas, con una prueba de regresión que cubra la navegación enmascarada que incluye un hash.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Which project does this relate to? Router
Describe the bug
A navigation with mask stores the real (logical) location in history.state.__tempLocation. commitLocation spreads the built location into it, whose hash has no leading # (buildLocation returns hash: hash ?? ""). parseLocation then reads __tempLocation back with decodePath(hash.slice(1)), so the logical hash loses its first character. An app that carries the current hash forward loses one more character per navigation: anchor -> nchor -> chor -> hor.
Your Example Website or App
Standalone script below (Node 22, @tanstack/react-router 1.169.2; same code in router-core 1.171.39).
Steps to Reproduce the Bug or Issue
import { createRouter, createRootRoute, createRoute, createMemoryHistory } from "@tanstack/react-router"
const root = createRootRoute()
const home = createRoute({ getParentRoute: () => root, path: "/" })
const chat = createRoute({ getParentRoute: () => root, path: "/chats/$chatId" })
const router = createRouter({ routeTree: root.addChildren([home, chat]), history: createMemoryHistory({ initialEntries: ["/"] }) })
await router.load()
let hash = "anchor"
for (let i = 1; i <= 3; i++) {
void router.navigate({ to: "/", hash, mask: { to: "/chats/$chatId", params: { chatId: "c1" }, hash } })
await new Promise((r) => setTimeout(r, 50))
hash = router.parseLocation(router.history.location).hash
console.log(i, JSON.stringify(hash))
}
// 1 "nchor" 2 "chor" 3 "hor"
Expected behavior
The logical location parsed back from a masked entry keeps its hash: "anchor" every time.
Suggested fix
In commitLocation, store the hash with its # in __tempLocation, as parse expects (it already does for history.location):
__tempLocation: {
...nextHistory,
search: nextHistory.searchStr,
+ hash: nextHistory.hash ? `#${nextHistory.hash}` : "",
- Lenguaje dominante
- TypeScript
- Estrellas
- 15.3k
- Forks
- 1.9k
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 46
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/router
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
router-generator: lazy-load Prettier (costs ~300–450ms per build even when formatting is off)Posiblemente ocupada @Sheraff la tomó hace 27 días. Abiertopackage: router-generator performance
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
router-generator: sibling `physical()` subtrees in a virtual route config generate duplicate identifiersPosiblemente ocupada @Sheraff la tomó hace 27 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
docs(router): clarify static title fallback in SPA modePosiblemente ocupada @Rohan-Dedhia la tomó hace 17 días. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
router.startViewTransition leaves the ready/finished promises unhandled, so a skipped transition throws an unhandled AbortErrorPosiblemente ocupada @unjica la tomó hace 29 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
TanStack/router#8776 · 3 comentarios · 2 reacciones ·
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/router
Issues similares
-
Add: GTrekkerAbiertocheck:passed streams:add
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
area: ui Bug Payload OSS
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
payloadcms/payload#19839 ·
Los mantenedores suelen responder en 1 día
-
external
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ClickHouse/ClickStack#3761 ·
Los mantenedores suelen responder en 1 día
-
fix(auth): add the email OTP verification step to Pollar loginPosiblemente ocupada @akansnoro la tomó hoy. AbiertoStellar Wave
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
safetrustcr/dApp-SafeTrust#584 · 10 comentarios ·
Los mantenedores suelen responder en 1 día
-
The manager preset saves launch definitions without the required file and digest pairPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día