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

6,597 commits

Author SHA1 Message Date
Tanner Linsley
ec874be1df fix: default redirect status code to 307 2024-08-27 11:09:56 -06:00
chencheng (云谦)
598121d929
docs(start): package.json block for the "getting started" guide (#2193)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-27 19:55:07 +12:00
Tanner Linsley
8e61210183 release: v1.51.0 v1.51.0 2024-08-27 07:47:47 +00:00
Tanner Linsley
21bf687b26
feat(start): add api routes (#2185)
* feat: partial work on file based api routes

* feat(router-generator,start): tsr config to support `apiBase`

* feat(router-generator): adding the route template

* feat(router-generator): smoke test to make sure no conflicting configurations are found

* chore(start-basic): cleanup to a workable state

* feat(router-generator): generate the manifest for api-routes

* feat(start): make sure requests are getting through

* fix(react-router,start): get the exports sorted

* refactor(router-generator): to use the same output as normal route files

* feat(start): piping the manifest to the api-handler

* chore(start): remove unused config option since the apiBase is being taken from tsr-generator

* fix(start): only add the api router to vinxi if its handler exists

* style(start): eslint

* test(router-generator): checking that the custom base is respected by the generator

* chore(start): add a dot notated api route and `console.debug` instead

* refactor(router-generator,start): normalize the capitalization of "API" across the generator and start

* fix(start): `createAPIHandler` to `createApiHandler`

* feat(router-generator,start): correctly output the api build chunks

* feat(start): 🎉 API-routes are working
now it just needs Tanner's multi-sort logic stuff added-in

* fix(start,router-generator): split the API stuff from the "server" export to its own "api"export

* feat(router-generator): handle updating the path `escapedPath` on API-Routes like we do for regular file-routes

* refactor(router-generator,start): rename functions

* feat(start): add logic for route matching with TSR routes

* feat(react-router,router-generator,start): remove the stuff to do with generating the "api-manifest". only the existing "route-manifest" remains. the additional tests have also been removed

* fix(start): filter out potential api-route mismatches before trying to begin the actually "find" process

* test: start-basic example with api routes

* chore: add a DEPLOY_URL field to better show that the user needs to supply this SSR

* test: start-basic-react-query example with api routes

* chore: rename "post" to "user"

* feat(start): allow the HTTP "HEAD" method

* feat(start): solution for code-based api-routes

* revert(start): undo the code-based approach since the production builds didn't work

* feat(start): add back the code-based approach

* chore(start): rename type "APIFileRouteReturnType" to "APIRouteReturnType"

* fix(start): path logic to make sure url segments cannot be less than route segments

* refactor(start): code-based approach to accept a an object of routes keyed under "routes"

* chore(start): add comments since

* refactor(router-generator,start): less exports and reuse make the fs-router extensible

* refactor(start): a more generic name

* refactor(start): generic naming again

* refactor(start): strongly type the api handlers

* docs(router): update the file-based routing to callout that `/api` routes will be ignored by router

* docs(router): callout how the `api_base can be changed`

---------

Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
2024-08-27 19:46:20 +12:00
Tanner Linsley
07a6b72c12 release: v1.50.2 v1.50.2 2024-08-26 10:57:21 +00:00
Christopher Horobin
1376843410
refactor(start): loosen the type of input for deployment preset in defineConfig (#2176)
* refactor(start): loosen the deployment preset configuration input type

* refactor(start): remove export ident

---------

Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
2024-08-26 22:53:35 +12:00
NekoChan
edd963eff5
docs(start): incorrect import path for TanStack Query (#2187)
Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
2024-08-26 22:47:32 +12:00
Tanner Linsley
8f5c76897b docs: init ssr docs 2024-08-25 21:59:09 -06:00
Tanner Linsley
17836f2e54 docs: add static prerendering 2024-08-25 21:46:21 -06:00
Tanner Linsley
8bebd3eba1 release: v1.50.1 v1.50.1 2024-08-26 02:57:46 +00:00
Christopher Horobin
9421aef439
fix: enforce trailing slashes better and general relative pathing improvements (#2186) 2024-08-26 04:56:38 +02:00
Tanner Linsley
c2d4a9e422 docs: update server functions 2024-08-25 13:53:28 -06:00
Tanner Linsley
77f32a7e6f docs: init server function docs 2024-08-25 13:38:59 -06:00
Tanner Linsley
ff38d84777 release: v1.50.0 v1.50.0 2024-08-23 23:05:35 +00:00
Christopher Horobin
00ab94253f
feat(react-router): allow narrowing of matches with useMatches (#2058)
* feat(react-router): add isMatch type predicate

* chore: add to example

* refactor: optimised types

* chore: use `constrain`

* fix: add a few fixes and tests

* chore: add experimental tag
2024-08-24 01:04:00 +02:00
Tanner Linsley
d1d608685d release: v1.49.8 v1.49.8 2024-08-23 22:08:49 +00:00
Christopher Horobin
a8d080b553
perf(react-router): reduce type parameters of route definitions (#2161)
* perf(react-router): reduce instantiations of route definitions

* chore: change `type` import
2024-08-24 00:05:05 +02:00
Tanner Linsley
6ef147533d release: v1.49.7 v1.49.7 2024-08-23 18:50:42 +00:00
Tanner Linsley
e4b1b3ee85 fix: force release of last PR 2024-08-23 12:46:14 -06:00
Tanner Linsley
333efe0e7b
[experimental] fix: safer history patching (#2181)
* fix: safer history patching

* fix tests

---------

Co-authored-by: Manuel Schiller <manuel.schiller@caligano.de>
2024-08-23 20:44:13 +02:00
Tanner Linsley
23cbb9a402 release: v1.49.6 v1.49.6 2024-08-23 15:19:24 +00:00
Sean Cassiere
d875321d12
fix(start): deferred createServerFn calls fails on the client (#2172)
* fix(start): deferred `createServerFn` calls failing on the client

* test(start-basic): add e2e check to make sure the complex deferred object gets printed on the page

* test(start-basic): more tests to make sure nothing is breaking
2024-08-23 09:17:43 -06:00
Sean Cassiere
cabd42686e
docs(start): markdown to follow the website flow (#2173)
* docs(start): markdown to follow the website flow

* docs(start): fixup the content hierarchy for the getting started guide
2024-08-23 19:31:49 +12:00
Gerard Ketuma
b8c0420a75
docs(router): fix grammatical errors in the "Code-splitting" guide (#2171) 2024-08-23 16:55:49 +12:00
Tanner Linsley
b1da3140bb release: v1.49.5 v1.49.5 2024-08-22 23:58:50 +00:00
SeanCassiere
a44858a68a
refactor(start): mark node-server as a tested deployment preset 2024-08-23 11:55:07 +12:00
SeanCassiere
e41464cd42
refactor(start): mark cloudflare-pages as a tested deployment preset 2024-08-23 11:50:38 +12:00
Tanner Linsley
f8118822a4 release: v1.49.4 v1.49.4 2024-08-22 23:26:20 +00:00
Kenta Iwasaki
e1f1564768
fix(start): load meta only on successful hydration (#2166)
When a route is matched to be unsuccessful such that no loader data is
available, the meta function still gets called with undefined loader
data. Given that the type signature of the meta function assumes that
loader data is always to be defined, a change was made to only call the
meta function when a match is successful.
2024-08-23 11:22:32 +12:00
Sina Niyavarzi
8e0dd0d315
docs(start): fixed some grammatical errors in the Start "Overview" (#2170) 2024-08-23 11:22:10 +12:00
Tanner Linsley
bba02627c3 docs: partner images 2024-08-22 12:36:27 -06:00
Tanner Linsley
c068515595 docs: start typo 2024-08-22 12:31:28 -06:00
Tanner Linsley
4ce6c16050 docs: startners 2024-08-22 12:30:53 -06:00
Tanner Linsley
dd134b55e4 docs: add placeholders for pillar features and partners 2024-08-22 12:00:50 -06:00
Tanner Linsley
52155a28aa docs: init start docs 2024-08-22 11:15:20 -06:00
Tanner Linsley
7f257e58e7 release: v1.49.3 v1.49.3 2024-08-21 20:55:21 +00:00
Sean Cassiere
8cf525d99c
refactor(router-generator,router-plugin,start): mark experimental.enableCodeSplitting functionality as stable with the name autoCodeSplitting (#2163)
* feat(router-generator): add the `autoCodeSplitting` option to the expected config

* refactor(router-plugin): accept the new `autoCodeSplitting` flag + throw an error if the older `experimental.enableCodeSplitting` flag is still being used

* refactor(start): update the vinxi configuration to use the new `autoCodeSplitting` flag instead of the `experimental.enableCodeSplitting` flag

* docs: update the "file-based-routing" guide with the correct flag

* docs: update the content in the "code-splitting" guide for better readability and communicate the necessary steps needed for using the feature

* docs: update the title on the "file-based-routing" guide

* examples: remove the older `experimental.enableCodeSplitting` flags from the trpc examples
2024-08-22 08:50:48 +12:00
Tanner Linsley
d1cb740737 release: v1.49.2 v1.49.2 2024-08-21 18:41:33 +00:00
Manuel Schiller
85a4fe934b
fix(react-router): restore previous matchRoutes signature (#2165)
* fix(react-router): restore previous `matchRoutes` signature

fixes #2164
2024-08-21 20:37:18 +02:00
Manuel Schiller
cf70c677f4
tests: reproducer for #2010 (#2045)
this was fixed in 1.49.1, keep this test to avoid future regressions
2024-08-21 19:55:03 +02:00
Pankaj chauhan
22f0985080
doc: update the accumulated router context guide to for checking breadcrumbs (#2160)
* doc(accumulated-route-context): useRouterState to listen reactive state change

* Apply suggestions from code review

Don't use `routeContext`, use `context` instead.

* ci: apply automated fixes

* docs: cleanup the breadcrumbs filer

---------

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-08-21 13:05:31 +12:00
Tanner Linsley
d318a1afa8 release: v1.49.1 v1.49.1 2024-08-20 21:30:53 +00:00
Tanner Linsley
f636b1d7cd
fix: splat matching (#2159)
* fix: splat matching

* fix: make _splat optional in params

---------

Co-authored-by: chorobin <chrishorobin@hotmail.com>
2024-08-20 15:28:37 -06:00
Tanner Linsley
3c20257342 release: v1.49.0 v1.49.0 2024-08-20 19:40:31 +00: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
Tanner Linsley
726897e223 release: v1.48.6 v1.48.6 2024-08-20 12:14:27 +00:00
Sean Cassiere
68b5b528c7
refactor(router plugin): restructure the plugin's internals (#2155)
* chore(router-plugin): rename "code-splitter" to "router-code-splitter"

* refactor(router-plugin): follow unplugin standards and move lib code into "core"

* test(router-plugin): update imports
2024-08-21 00:13:07 +12:00
Tanner Linsley
366f48140e release: v1.48.5 v1.48.5 2024-08-20 09:15:00 +00:00
Sean Cassiere
de2325b3a4
fix(router-plugin): plugin functionality for rspack 1.x.x (#2153)
* fix(router-plugin): bump dependencies to latest

* chore(router-plugin): remove vite from the dev dependencies

* chore: bump rspack deps for "quickstart-rspack-file-based" to 1.0-level deps

* chore(router-plugin): bump rspack peerDep level to 1.0.0

* types(router-plugin): explicit casting of ResolveData

* refactor(router-plugin): `transform` in the code-splitter no longer needs to be async
2024-08-20 21:13:51 +12:00
Tanner Linsley
4d787a8dfc release: v1.48.4 v1.48.4 2024-08-19 08:45:18 +00:00