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

81 commits

Author SHA1 Message Date
akhmadshin
02a4957b64
feat(react-router): allow to preload route chunk (#3016)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Manuel Schiller <manuel.schiller@caligano.de>
2024-12-16 23:42:34 +01:00
Manuel Schiller
437fb7457a docs(react-router): fix blocker doc 2024-12-15 11:21:21 +01:00
Tom Rehnström
f420670bf2
feat(react-router): update useBlocker hook to provide current and next location when conditionally blocking (#1790)
* chore: clean up changes

* feat: clean up work and address feedback

* feat: add backwards compat

* ci: apply automated fixes

* feat: give history action to subscribers via notify

* fix: provide go index to history subscribers

* docs: updated docs accourding to feedback

* fix: changed valid notify call

* rename to `type`

* remove non existing `pushstate`event

* cleanup

* typesafe API for shouldBlockFn

* feat: added blocking state to resolver and updated examples

* docs: updated useBlocker and navigation-blocking docs

* test: added type tests to blocker and changed type implementation of blocker

* test: added better unit tests for useBlocker hook

* test: added e2e tests for blocker and legacy blocker

* wip: stash files before merge

* fix: unstashed e2e file after merge

* fix lockfile

* docs

* typesafety for `<Block>`

* always return resolver to not break backwards compatibility

* fix: removed zod from navigation blocking example to fix build problem

* chore: update lock file

* finishing touches

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Manuel Schiller <manuel.schiller@caligano.de>
2024-12-15 10:32:16 +01:00
Josh Slate
92147140c8
feat(react-router): implement hash change "Scroll Into View" option (#2996)
* feat: implement hash change scrollIntoView option

* e2e tests for hash change scroll behavior

* update e2e tests to use data-testId

* address feedback

* remove accidental change to package.json

* add anchor link to example navigation

* ci: apply automated fixes

* handle when location transitions without commitLocation running

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-14 08:58:03 +01:00
Manuel Schiller
5ad95cf3f7
feat(react-router): allow to redirect to external targets, add reloadDocument option (#3004)
* feat(react-router): allow to redirect to external targets, add `reloadDocument` option

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-13 12:29:33 +01:00
Manuel Schiller
54dad5f872
fix(start): fix usage of use() with React 19 (#2963)
both router and react 19 were modifying the Promise object in a similar manner which caused a conflict.

See https://github.com/facebook/react/blob/v19.0.0/packages/react-reconciler/src/ReactFiberThenable.js#L162-L228 for how React 19 modifies the Promise object.

Both used an additional `status` property to track the Promise status, but router was using the value "success" and React was using the value "fulfilled" to mark a fulfilled Promise.

This change stores the router specific Promise tracking values using a symbol to avoid any potential collision.

fixes #2953
2024-12-09 18:24:04 +01:00
Manuel Schiller
67b3175720
fix(react-router): correctly react to search param changes (#2883)
Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-28 23:31:37 +01:00
Roberto De Lucia
70df20a53c
feat(react-router): add support for ViewTransition types (#2862)
Co-authored-by: Roberto De Lucia <roberto.delucia@sinnefo.eu>
Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-28 09:43:35 +13:00
Tanner Linsley
4d5d25bc08
Chained Server Fn Syntax, ServerFn Middleware (#2513)
* init

* Refactor createServerFn, add createServerMiddleware

* checkpoint

* checkpoint

* checkpoint

* update docs and examples to use new server function syntax

* fix: compilers, and update examples

* refactor: added merging of context and some type tests

* feat: createServerMiddleware context and input validation types

* checkpoint

* Server function middleware

* checkpoint

* checkpoint

* fix: return types from handlers, merging inputs etc

* checkpoint

* checkpoint

* checkpoint

* checkpoint

* feat: add types for client context and server context

* fix: merge server context

* checkpoint

* docs

* fix: better compilation of server functions

* fix: deferred example

* Html, Head, Body... be GONE!

* fix: API Routes

* checkpoint

* fix: support optional input types

* checkpoint

* fix lossy merge

* ci: fix build

* ci: fix start examples

* checkpoint

* feat: add client after context types

* test: add type tests

* checkpoint

* checkpoint

* Remove now-unnecessary data type headers

* checkpoint

* fix e2e test

* fix up merge conflicts

* ci: apply automated fixes

* fix: a few tests and a runtime bug

* chore: pnpm dedupe
except the search-validator-adapters example, everything else builds fine

* fix merge conflict

---------

Co-authored-by: chorobin <chrishorobin@hotmail.com>
Co-authored-by: Manuel Schiller <manuel.schiller@caligano.de>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
2024-11-14 09:43:20 -07:00
c-louis
5998ce4e06
docs: update RouterEventsType.md missing onBeforeNavigate (#2740) 2024-11-12 22:39:31 +01:00
Manuel Schiller
0873c1f0c9
feat(react-router): add support for structural sharing for finegrained selectors (#2647)
Co-authored-by: chorobin <chrishorobin@hotmail.com>
2024-11-09 22:41:12 +01:00
alma-lp
cc05ad8205
feat(react-router): allow unencoded characters in dynamic path segments (#2677) 2024-11-05 22:08:21 +13:00
xiaohai-huang
335fdede6a
fix(react-router): remove flashes caused by <ScrollRestoration /> (#2645)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-27 23:04:30 +01:00
Manuel Schiller
45236b7104
docs: fix clearCache description (#2660) 2024-10-27 22:23:58 +01:00
Sean Cassiere
ae10503cf0
feat(react-router): add preload='render' support (#2644) 2024-10-27 14:00:55 +13:00
Can Rau
98f0c509b0
docs(react-router): fix typo in stripSearchParamsFunction.md (#2641) 2024-10-26 00:41:26 +02:00
Manuel Schiller
eba70d5f57
feat(react-router): add method to selectively removed cached matches (#2575) 2024-10-18 23:41:37 +02:00
Manuel Schiller
8d56157b07
feat(react-router): add stripSearchParams middleware (#2579) 2024-10-18 22:33:18 +02:00
Manuel Schiller
93a62724a5
feat(react-router): allow to selectively invalidate matches (#2551) 2024-10-16 20:09:42 +02:00
Manuel Schiller
2d0ff561cc
feat(react-router): added router option search.strict (#2552)
Configures how unknown search params (= not returned by any `validateSearch`) are treated.
2024-10-16 18:27:52 +02:00
Manuel Schiller
86df9e77b0
feat(react-router): allow to retain all search params via retainSearchParams (#2549) 2024-10-15 20:42:46 +02:00
Manuel Schiller
60b3f37e32
feat(react-router) add search middleware (#2521)
* feat(react-router) add search middleware

* add `retainSearchParams` middleware

* simplified types

* added docs
2024-10-14 20:34:35 +02:00
Christopher Horobin
f48dd37b35
feat: add linkOptions for re-usable props (#2486)
* feat: add `linkOptions` for re-usable props

* chore: change examples

* docs: add docs for `linkOptions`

* tests: add type tests for `linkOptions`

* chore: fix spelling

* chore: update docs and make `const`
2024-10-07 23:22:47 +02:00
Christopher Horobin
42f703d05b
feat(react-router): add context option to route (#2104)
* feat(react-router): add types for routeContext

* perf(react-router): optimise new types for `routeContext`

* chore(react-router): add type tests for routeContext and beforeLoad

* checkpoint

* ci: apply automated fixes

* updates docs

* fix: tests

* fix: context

* chore: fix the lockfile

* ci: apply automated fixes

* style(react-router): fixup the eslint errors

* fix: hydration mismatch during SSR, refactor matchRoutes to take location

* fix: serialize beforeLoadContext during SSR

* examples: add start-basic-auth

* fix: history export parseHref

* feat: routeOptions.preload to allow disabling route-level preloading

* fix: full support for href redirects

* feat: useServerFn hook to allow handling server side effects like redirects outside of router lifecycles

* fix: server redirect and notFound now default to 200 status code for runtime to handle

* fix: update pnpm

* ci: apply automated fixes

* examples: fix start-basic-auth

* tests: fix playwright

* tests: fix playwright

* tests: fix playwright

* sean's changes to the route context branch (#2141)

* chore: type the objects used for `routeContext` and `beforeLoad`

* refactor: move the defaultTransformer from start to react-router

* test: add tests to the defaultTransformer

* test(react-router): add runtime unit tests for the `context` function

* examples: init start-clerk-basic

* fix: lockfile

* ci: apply automated fixes

* test: remove failing test for WIP clerk example

* tests: fix more clerk wip tests

* fix: lockfile

* tests: more clerk fixes

* tests: skip WIP clerk example

---------

Co-authored-by: Tanner Linsley <tannerlinsley@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
2024-08-20 13:39:17 -06:00
jun won
1f5168dc3f
docs: fix a typo in useBlocker example code block (#2136) 2024-08-15 14:43:35 +12:00
Sean Cassiere
75bae7ab8c
docs: correct the documentation on the expected behaviour of Router.onError (#2134) 2024-08-15 12:52:33 +12:00
Sean Cassiere
c66e1b55eb
fix(react-router): explicitly set the default notFoundMode and update the RouterOptions JSDoc comments (#2133)
* fix(react-router): set the default `notFoundMode` during instantiation

* docs: update `RouterOptions` with `notFoundMode` and `defaultViewTransition`
2024-08-15 12:30:06 +12:00
Sean Cassiere
2423d02ce2
docs: remove the invalid context and location arguments from being shown as "available" in the loaderDeps route method (#2091) 2024-08-06 20:18:17 +12:00
Sean Cassiere
84605c035c
feat(react-router): support for preload='viewport' (#2062)
* feat(react-router): expand the types to allow the preload setting of "viewport"

* feat(react-router): add the `useIntersectionObserver` and `useForwardedRef` hooks

* feat(react-router): add the configuration to use `preload='viewport'`

* chore(react-router): cleanup `console.log`

* chore(react-router): types I can be happy with

* refactor(react-router): make the `useIntersectionObserver` hook testing compatible

* test(react-router): testing for preload='viewport'

* test(react-router): move the `IntersectionObserver` mock into the utils

* docs: update the preloading guide

* docs: api reference

* chore: apply suggestions from code review
2024-08-01 10:48:06 +12:00
Manuel Schiller
08bbb333c2 docs: fix typos 2024-07-30 22:20:26 +02:00
Manuel Schiller
f0794aeea7
docs: link to useRouterState 2024-07-30 20:35:03 +02:00
Manuel Schiller
70148fc2ef
fix formatting in useRouterHook.md 2024-07-30 20:34:42 +02:00
Manuel Schiller
6bbdc7cbee
docs: warn that router.state is not reactive in the useRouter doc 2024-07-30 20:32:50 +02:00
Manuel Schiller
60c346baf0
docs: fix useLoaderDepsHook doc 2024-07-30 20:29:59 +02:00
Manuel Schiller
f5e011cb8f
Update useLoaderDataHook.md 2024-07-30 20:22:57 +02:00
Sean Cassiere
03b05999c5
docs: cleanup the Reference API page having the hooks being suffixed with (.md) (#2038) 2024-07-27 14:39:58 +12:00
Tom Ballinger
02f934c643
docs: Warn against DOM-rendering elements in Wrap and InnerWrap (#2017)
* Warn against DOM-rendering elements in Wrap and InnerWrap

* update docs

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-25 20:20:15 +02:00
Sean Cassiere
b5eabe19f5
docs: native markdown relative hyperlinks (#1998)
* docs: reference docs

* docs: guides

* docs: top-level

* docs: missed the route-trees

* docs: fixing routing-concepts
2024-07-20 18:23:45 +12:00
Manuel Schiller
bacd6b7f22
feat: allow useMatch to not throw if match was not found (#1738)
in this case, `matchRoute` will return undefined
2024-07-12 22:09:43 +02:00
Sean Cassiere
9880bb8bb1
docs: use gfm alerts in the documentation (#1924)
* docs: gfm alerts on the deprecated apis

* docs: gfm alerts in the api reference

* docs: gfm alerts in framework/react

* docs: gfm alerts in framework/react/guide

* docs: more gfm alerts in the api reference

* docs: update to the decisions on dx doc
2024-07-10 11:46:21 +12:00
Tanner Linsley
23614fa79a fix: add react-router-with-query experimental package 2024-07-01 00:15:41 -06:00
Christopher Horobin
1d733f6cc6
feat(react-router): params.parse and params.stringify instead of parseParams and stringifyParams (#1826) 2024-06-28 18:34:49 +02:00
Manuel Schiller
b1213eb57d
feat: allow to ignore blocker in navigate and <Link> (#1797) 2024-06-21 19:49:33 +02:00
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