Child routers: render another location with the parent's history
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- frontend
Direzione di ricerca
Read the prototype linked in the issue, then inspect router.ts and the Transitioner guards it describes. The proposal also calls for tests and a stack-pages example; compare those with the prototype to define the API and behavior. Done means child routers share parent history and blockers, keep navigation relative to the child location, and avoid URL changes and extra global listeners.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
We keep pages mounted under sliding panels: any page can open on top of the current one with stackNavigate('/foo/p1'), and the page below keeps its exact state (form input, filters, scroll). The URL is always the top page, the pages below live in history state.
Right now the only way to do this with TanStack Router is a createRouter per layer plus a hand-written RouterHistory that's fixed to one location. It works, but every router adds scroll restoration listeners that are never removed (#8775), every Transitioner canonicalizes and replaces the URL on mount, self.__TSR_ROUTER__ gets overwritten, and the custom history has to implement _getBlockers/notify.
Proposal, a parent option:
const child = createRouter({ ...router.options, parent: router, location: '/foo/p1' })
child.setLocation('/foo/p2')
A child uses the parent's history and blockers, hands its navigations to the parent (relative to still resolves against the child's location), never reads or writes the URL, adds no global listeners and doesn't touch __TSR_ROUTER__. Hooks stay the same, each child has its own RouterProvider. Out of scope for now: sharing committed match data, SSR, transitions.
I made a prototype to see how it looks: compare. It's ~45 lines in router.ts plus a 2-line guard in each Transitioner, with tests and a stack-pages example. In our app it removes our whole custom layer history.
Is parent an OK shape, or would you prefer something like a free createChildRouter(router, { location })? Happy to turn it into a PR once the API is agreed.
- Lingua principale
- TypeScript
- Stelle
- 15.3k
- Fork
- 1.9k
- Merge medio
- 1g 5h
- PR unite (30g)
- 46
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/router
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Masked navigation drops the first character of the hash each time (__tempLocation hash missing '#')Forse già presa @hassanabrar202 l’ha presa 8 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
router-generator: lazy-load Prettier (costs ~300–450ms per build even when formatting is off)Forse già presa @Sheraff l’ha presa 27 giorni fa. Apertapackage: router-generator performance
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
router-generator: sibling `physical()` subtrees in a virtual route config generate duplicate identifiersForse già presa @Sheraff l’ha presa 27 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
docs(router): clarify static title fallback in SPA modeForse già presa @Rohan-Dedhia l’ha presa 18 giorni fa. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TanStack/router
Issue simili
-
[BUG]: Shared links drop the configured basePath on GitHub PagesForse già presa @anshulchikhale30-p l’ha presa oggi. Apertabug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
StabilityNexus/IdentityTokens-EVM-Frontend#182 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Add: GTrekkerApertacheck:passed streams:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Koenkk/zigbee-herdsman-converters#13900 ·
I maintainer di solito rispondono entro 1 giorno
-
area: ui Bug Payload OSS
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
payloadcms/payload#19839 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
jeanibarz/knowledge-base-mcp-server#1291 ·
I maintainer di solito rispondono entro 1 giorno