0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
Commit graph

38 commits

Author SHA1 Message Date
Tanner Linsley
0be110012c fix: no more weird streaming APIs, just use suspense + streaming 2024-05-26 22:56:02 -06:00
Leonardo Montini
28aa8fb04e
feat(react-router): improve the blocker functionality for use with custom UI (#1649)
* feat: return async resolver from useBlocker hook

* feat: pass async resolvers to children on Block component

* fix: types and always reset promise

* docs: update example with custom UI

* refactor: namings

* docs: toggle between custom ui and default

* feat: expose status and refactor hook props

* feat: support current API

* feat: custom blocker should take precendence over the manual promise blocker

* test: unit test on condition to avoid breaking changes with the new API

* docs: deprecate old syntax and update the docs

* docs: create useBlocker API reference

* fix: deprecated interface
2024-05-25 13:49:08 +02:00
Sean Cassiere
d20a422160
docs: touchups to the reference pages for RouterState type, useRouterState, and useMatches (#1645)
* docs: better RouterState doc

* docs: useRouterState updates

* docs: useMatches

* docs: forgot to do that

* docs: and that
2024-05-21 20:40:38 +12:00
Sean Cassiere
59e3f52286
docs: update the content on the reference page for RouterEvents type (#1644)
* docs: update the content on the `RouterEvents type` reference page

* docs: verbiage

* docs: make it simpler
2024-05-21 17:57:04 +12:00
Sean Cassiere
ab02f3ebd3
docs: moving reference content out of the class files (#1633)
* RouterType

* RouteApiType

* RouteType

* ParsedLocation linking

* linking RouterType, RouteType, and RouteApiType

* reduce SearchParamOptionsType and PathParamOptionsType into ToOptionsType

* useLinkProps

* forgot to remove that

* more
2024-05-19 14:52:44 +12:00
Dominik Dorfmeister
099aa926ef
refactor: JsDoc for RouterOptions (#1631) 2024-05-18 23:43:29 +02:00
Sean Cassiere
62bf384972
docs: clearing up the internal types from the references (#1627)
* remove AnyParamsType

* remove AnyRedirectType

* AnyRouteMatchType

* AwaitOptionsType

* FileRoutesByPath

* FullSearchSchemaType

* ParseRouteType

* ParseRouteChildrenType

* RegisteredRouterType

* RouteByIdType

* RouteIdsType

* RouteByPath

* RoutePathsType

* RouterErrorSerializerType

* link RouterEventsType

* RouterTransformerType

* RoutesByIdType

* RoutesByPathType

* SearchSchemaInputType

* link to ToOptionsType

* DeferredPromiseStateType
2024-05-19 01:37:49 +12:00
Dominik Dorfmeister
6c1d831b27
feat: onCatch callback on routes and defaultOnCatch for router (#1623)
* feat: onCatch callback on routes and defaultOnCatch for router

to catch errors thrown by ErrorBoundaries

* docs: onCatch

* docs: add default
2024-05-18 14:49:25 +02:00
Manuel Schiller
45252f3d66 docs: fix links 2024-05-17 00:05:55 +02:00
Sal Hasan
2a19b03d6b
feat(react-router): add a useLocation hook to get the current ParsedLocation (#1577) 2024-05-11 14:33:15 +02:00
Manuel Schiller
e08b881358
feat: strong typing for onEnter, onStay and onLeave (#1479) 2024-04-19 22:28:28 +02:00
Tanner Linsley
7b173f5088 fix: always use React transitions around navigations, experimental view transitions API 2024-04-18 16:33:04 -06:00
Tanner Linsley
d09db60415 fix: Refactored many things!
- Fixed an issue where preloads would redirect and not resolve to the correct location
- Removed the need for `getRenderedMatches`. The matches intended to be rendered are now always stored at `store.matches`
- Removed the experimental ability for async meta and headers. Loaders should be used to get async data into these functions
- Pending matches now take `beforeLoad` into account and properly start pendingMs timers.
- `pendingMinMs` is also more accurate now by only triggering its timers when the pending state is encountered during rendering
- Removed a logical path where the `pending` component could be directly rendered within a route instead of handled by suspense
- Matches that don't require loaders or beforeLoaders will start as "success".
- Meta and headers are now called and saved for matches that are cached or already in the "success" state
- Fixed an issue where redirects and not-found errors would get improperly swallowed
- Fixed an edge-case where outdated navigations were not ignored and created race-conditions
- Refactored isServer into the router so we can do some better mocking in tests
- Added tests around scripts, meta, and redirects
- Fixed issues with non-vinxi server envs
- Injected html now waits for <body>

Closes #1104 #1146 #1168
2024-04-15 16:11:22 -06:00
Manuel Schiller
3d3f91859e
feat: allow to configure trailing slash behavior (#1464) 2024-04-12 23:07:39 +02:00
Sean Cassiere
136477c3dd
deprecate: navigate function as an argument in the beforeLoad and loader callbacks (#1459)
* feat(react-router): mark the `navigate` function in the `beforeLoad` and `loader` callbacks as deprecated

* docs: mark the navigate function passed into the `beforeLoad` and `loader` functions as deprecated
2024-04-12 18:03:15 +02:00
Tanner Linsley
4ef78725af
docs: prep for migration of tanstack.com to TSR (#1419) 2024-04-02 16:46:22 -06:00
Dominik Dorfmeister
9f9b847ea7
feat: add reset prop to errorComponent (#1358)
* feat: add reset prop to errorComponent

* fix: types of defaultErrorComponent

* fix: put match into pending state when being invalidated if it was in error state

* docs: reset

* docs: error handling

* docs: integrate error handling into example

* chore: prettier on md files

* chore: fix wrong auto import

* fix: reset error boundaries from react-query in an effect

so that navigating away from a route will also re-trigger the query

* docs: error handling with TanStack Query

* chore: fix eslint

* fix: not all error components have a `preload`

* fix: merge conflict
2024-03-29 23:21:04 +01:00
Sean Cassiere
5eba66bb80
feat(react-router): implement the typed useNavigate hook onto the Route and LazyRoute class (#1385)
* feat(react-router): return the useNavigate hook

* docs(react-router): update verbiage on the RouteClass doc

* test(react-router): ensure the typed hooks are available across the shared surfaces
2024-03-28 19:06:16 +01:00
Sean Cassiere
9d099dd755
docs: add reference pages for createLazyFileRoute and createLazyRoute (#1379)
* docs: add createLazyFileRoute

* docs: broken link to the FileRouteClass

* docs: remove the word literal

* docs: update the source of its configuration options

* docs: add createLazyRoute
2024-03-27 21:38:59 +13:00
Manuel Schiller
9687ebd90a
fix: loosen strict check in useMatch to allow accessing parent matches (#1356) 2024-03-22 23:52:27 +01:00
Sean Cassiere
58a15deb49
docs: add more missing reference pages (#1352)
* docs: add useNavigate to the RouteApiClass

* docs: add the useLoaderDeps hook

* docs: update RouteApi description

* docs: update getRouteApi description

* docs: add the useRouterState hook

* docs: add the useRouter hook

* docs: missing `hook` from title

* docs: add the useRouteContext hook

* docs: add the useSearch hook
2024-03-22 09:01:20 -06:00
Nils Hartmann
734970aacc
docs: fix useMatchHook (#1282)
- options argument is not optional
- clarify opts.from/opts.strict dependency
2024-03-09 16:21:58 +01:00
Manuel Schiller
409b06dbb7 chore: fix doc formatting 2024-03-09 11:57:34 +01:00
Sean Cassiere
e4bc7d7e0a
docs: normalizing the hierarchy content in the reference pages (#1232)
* createFileRoute

* createRootRoute

* createRouteFunction

* createRouteFunction and RouteClass

* defer, awaitComponent, useAwaitedHook

* getRouteApiFunction and RouteApiClass

* isNotFoundFunction

* isRedirectFunction

* lazyRouteComponentFunction

* createRootRouteWithContext

* createRootRouteFunction

* new notFound conventions

* NotFoundRouteClass

* redirectFunction

* RedirectType

* catchBoundaryComponent

* catchNotFoundComponent

* DefaultGlobalNotFound

* useLinkPropsHook

* ActiveLinkOptions

* errorComponentComponent

* linkComponent

* LinkOptionsType

* LinkPropsType

* navigateComponent

* NavigateOptionsType

* outletComponent

* ToOptionsType

* FileRouteClass

* add the word type

* rootRouteWithContextFunction

* matchRouteComponent

* MatchRouteOptionsType

* useChildMatchesHook

* useLinkPropsHook

* UseLinkPropsOptionsType

* useLoaderDataHook

* useMatchesHook

* useMatchHook

* useMatchRouteHook

* UseMatchRouteOptionsType

* useNavigateHook

* useParamsHook

* useParentMatchesHook

* AllParamsType, RegisteredRouterType, RegisterType

* alphabetical sorting

* add link to the RouteMatchType

* useLoaderDataHook

* AnyRouteMatchType

* bulk for types

* consistency in page linking

* remove backticks from heading items that do not wrap inline-code-blocks
2024-03-08 11:37:02 +01:00
Tanner Linsley
3b559fc931
fix: ssr improvements (#1248)
* fix: ssr improvements

* fix: remove log

* fix: remove log

* fix: remove comments

* docs: root abstraction

* fix: remove commented code

* fix: remove old TLoaderData fix attempt

* fix: remove commented code

* fix: imports

* docs: format

* fix: deprecate and handle not found "global" option
2024-03-04 11:23:41 -07:00
Sean Cassiere
b2004cbbdc
docs: fixing some inconsistencies in the guides (#1229)
* fix: `routeTree` into the `createRouter` instance

* fix: switch to `Block/useBlocker` since react-router uses `useBlocker` instead of `Prompt/usePrompt`

* fix: rename RouteApi to getRouteApi and include useLoaderDeps

* feat: indicate `.lazy` suffix and mark deprecation suffixes being phased out

* fix: createRootRouteWithContext - `routeTree` into the `createRouter` instance

* fix: rootRouteWithContext - `routeTree` into the `createRouter` instance

* feat: `Function` keyword is redundant since its already nested under `Functions`

* feat: alphabetical sorting of functions

* feat: move `rootRouteWithContext` to the deprecated list

* feat: use backticks

* feat: alphabetical sorting of hooks
2024-02-27 11:55:10 -07:00
Nikola Hristov
0fab06123b
fix: replace JSX.Element with React.ReactNode for children-like props (#1221) 2024-02-25 21:52:00 +01:00
Tanner Linsley
8c6de040c1 fix: better error, not found and redirect propagation 2024-02-16 15:37:48 -07:00
lunacrafts
e703b8d6df
docs: Remove .md suffix from guide links (#1189) 2024-02-15 23:13:43 +01:00
Sean Cassiere
c827951c7a
docs: prefer the usage of the getRouteApi function over direct Route config consumption (#1143)
* docs: path-params

* docs: search params

* docs: type-safety

* docs: useParams reference

* docs: code-based routing

* docs: data mutations

* docs: route-trees

* docs: search-params

* docs: deferred-data-loading

* docs: revert unneccessary changes and leave in a stub to add the "tips"

* docs: forgot to include in the last commit

* docs: add the "🧠 Quick tip" items about the `getRouteApi` function
2024-02-12 23:59:55 -07:00
Tanner Linsley
81d8dcdd62 docs: useChildMatches docs 2024-01-29 09:48:48 -07:00
Manuel Schiller
c70b10ef2f
fix: deprecate rootRouteWithContext in favor of createRootRouteWithContext (#1098) 2024-01-28 15:58:26 -07:00
Manuel Schiller
b04458135e
fix: MatchRoute now uses same props as useMatchRoute (#1096)
do not require to specify path params
2024-01-28 22:04:13 +01:00
Manuel Schiller
d02bc45bd6 docs: update to latest API 2024-01-28 00:46:31 +01:00
gilbert
dcfd9d7246
feat: new not found APIs (#1048)
* feat: add `notFound`, boundary, and support for routes

* feat: add global not found

* refactor: clean up throw global not found route

* feat: reset not founds on page navigation

* fix: fix duplicate throw global not found

* feat: rework global not found handling and add not-found-ssr example

* feat: update not found ssr example

* fix: fix type in not-found.tsx

* feat: add way to statically render a global not found page

* feat: remove flicker from notFound with SSR

* feat: remove <GlobalNotFound> server api

* feat: add file-based routing and codesplitting for not found component

* feat: add option to trigger not found on specific route

* docs: write docs for `notFound` and `NotFoundError`

* docs: document Route.notFound(opts)

* feat: add deprecation warnings to notFoundRoute

* fix: clean up a few things that went awry during rebase

* fix: fix react-router-server build

* feat: add not-found apis to basic-file-based example

* feat: update basic-ssr-streaming-file-based example to use new not-found apis

* chore: clean up a few things

* docs: write guides for new not found api

* docs: add api documentation for `not-found.tsx`

* feat: add notFoundComponent to lazy loading

* docs: deprecate NotFoundRoute and link to new apis

* fix: remove `.notFoundComponent` suffix in file based routing

* feat: make `route` option of typesafe and compatible with `getRouteApi`
2024-01-27 09:12:54 -07:00
Nirjhor Nath
6d54fab6c8
feat: Add data transformer API (#1059) 2024-01-27 00:05:18 +01:00
Montasar Jarraya
acb75e1499
docs: rename createRouteApiFunction.md (#1085) 2024-01-26 10:30:58 -07:00
Lachlan Collins
77955ab586
docs: Re-organise for new docs layout (#1081) 2024-01-26 09:43:15 +11:00