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

6,221 commits

Author SHA1 Message Date
Lleyton W Morris
bdea54ddf3
docs(router): add route.tsx in directory vs flat routing guide (#4257)
Co-authored-by: Lleyton Morris <lmorris@nexigen.digital>
2025-05-27 00:03:48 +12:00
Tanner Linsley
790016d141 release: v1.120.10 v1.120.10 2025-05-24 09:16:38 +00:00
Lenz Weber-Tronic
ef01673dc6
fix: handle Symbol properties and non-enumerable properties in replaceEqualDeep (#4237)
Opening this PR for discussion, I'm very open to scope changes.

This PR tackles two problems with `defaultStructuralSharing: true`:

1. symbol properties are not taken into account for "object equality"
and are not copied over when creating a new copy
2. non-enumerable properties are not taken into account for "object
equality" and are not copied over when creating a new copy

Point 1. actually is causing some of our users a headache, see
https://github.com/apollographql/apollo-client/issues/12619 and
https://community.apollographql.com/t/preloadquery-with-tanstack-router-loader/9100
.

Users expect that they're able to pass an object with symbol properties
over from a loader into components, but when having
`defaultStructuralSharing` enabled, from the second object that is
passed over, it creates a copy and strips off symbol properties.
That new object without the expected symbol properties will then crash
our `useReadQuery` hook.

In other words, the first loader call returns
```js
{
    refObject: { toPromise: Function1, [secretSymbol]: ImplementationDetail1 }
}
```
the component receives
```js
{
    refObject: { toPromise: Function1, [secretSymbol]: ImplementationDetail1 }
}
```
and the second loader call returns
```js
{
    refObject: { toPromise: Function2, [secretSymbol]: ImplementationDetail2 }
}
```
but the component receives
```js
{
    refObject: { toPromise: Function2 }
}
```
`toPromise` is a different function, so it goes into the "clone" path,
but skips the `secretSymbol` property.

If we wouldn't have that `toPromise` property on there (and we're
considering removing it!), it would even be worse to debug - users would
always stay on the first `refObject` and never get the second, since
both objects would be considered equal.

On our side, passing these objects from loaders to components is
actually an intended pattern, so this is causing quite a bit of problems
- see this example from our docs (see [Initiating queries outside
React](https://www.apollographql.com/docs/react/data/suspense#initiating-queries-outside-react)):

```ts
import { useLoaderData } from 'react-router-dom';

export function loader() {
  return preloadQuery(GET_DOGS_QUERY);
}

export function RouteComponent() {
  const queryRef = useLoaderData();
  const { data } = useReadQuery(queryRef);

  return (
    // ...
  );
}
```

Problem 2. is purely hypothetical and we haven't encountered it - but it
should probably be handled in some way.

Both of these problems can be handled in two ways:

* take these "special properties" into account for comparisons and copy
them over (my naive approach here would lose the "non-enumerability" of
these properties, more code would be necessary to keep that)
* in `isPlainObject` just return `false` if an object has non-enumerable
or symbol properties. This would opt out of structural sharing for these
objects (which is probably perfectly fine)

I'd be open for either of those solutions, and also for completely
dropping the "non-enumerable" case for simplicity, but I would be very
happy if we could get *something* in to help with symbol properties.
In React Query, these values can be assumed to be serializable JSON, so
the current implementation is perfectly fine, but with client-side
loaders, users can just pass anything, and here it's causing quite the
problem.
Telling our users to situationally turn off structural sharing would be
an educational nightmare.
2025-05-24 11:01:44 +02:00
Tanner Linsley
63c623b169 docs: fix links 2025-05-24 01:37:04 -06:00
Tanner Linsley
0d7dc76b60 release: v1.120.9 v1.120.9 2025-05-23 18:54:28 +00:00
Manuel Schiller
7eba99e328
fix: router.buildLocation use RegisteredRouter (#4242)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-23 20:53:06 +02:00
Tanner Linsley
bd9eb8b3a9 release: v1.120.8 v1.120.8 2025-05-23 17:31:26 +00:00
Manuel Schiller
5663aa601b
fix: proper HMR handling for file routes (#4240)
porting from alpha to main

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-23 19:30:01 +02:00
Tanner Linsley
986fa83e6d release: v1.120.7 v1.120.7 2025-05-22 22:27:14 +00:00
Christopher Horobin
5a8267971d
fix: type errors with skipLibCheck: false (#4233)
fixes #4114
2025-05-23 00:25:53 +02:00
scarf
0d71e044d8
docs(react-router): document migration path for parseParams and stringifyParams (#4216) 2025-05-22 20:08:04 +02:00
autofix-ci[bot]
385c47be5f
ci: apply automated fixes 2025-05-22 18:07:48 +00:00
Joel Tannas
d4321feac1
docs: Fix syntax error in search middleware example (#4223) 2025-05-22 20:06:50 +02:00
Leonardo Montini
72ffeb4d4a
docs: fix neon bullet points and url (#4214)
The markdown list wasn't shown properly and I noticed the signup link
was broken

Before

![image](https://github.com/user-attachments/assets/9efd3f90-3ed1-42af-823a-edb4fdd39770)


After

![image](https://github.com/user-attachments/assets/bc43b4ee-30b4-4eb8-ace2-6cd9ca77c2d9)
2025-05-20 20:44:56 +02:00
Tanner Linsley
dd3d33f567 release: v1.120.6 v1.120.6 2025-05-18 08:07:05 +00:00
Adam Hunter
699194749c
fix(router-devtools-core): adds missing containerElement prop support for TanStackRouterDevtoolsCore (#4126)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-18 09:52:39 +02:00
Tanner Linsley
ada2b08226 release: v1.120.5 v1.120.5 2025-05-16 20:36:47 +00:00
Manuel Schiller
7bf23b4b18
fix: head execution (#4189) 2025-05-16 22:33:26 +02:00
Tanner Linsley
13996c6875 release: v1.120.4 v1.120.4 2025-05-16 17:05:45 +00:00
Manuel Schiller
e18b333a60
fix: properly handle sessionStorage not being available for scroll restoration (#4186) 2025-05-16 19:03:16 +02:00
ThaumRystra
fa871a0e8b
docs(router): fix scrollRestorationBehavior option in "scroll-restoration" guide (#4169) 2025-05-16 12:20:48 +12:00
Luis Merino
5d940e2d8b
docs: specify that not found errors are handled by the nearest parent when called within loader (#4164) 2025-05-14 00:26:04 +02:00
Tanner Linsley
38142f4c68 docs: update comparison 2025-05-13 11:53:36 -06:00
Birk Skyum
9f93ce0df0
fix(docs): update src to images on tanstack.com (#4165)
tanstack.com has been updated to use /src instead of /app, which means
these broken asset links has to be updated too
2025-05-13 16:11:53 +02:00
Dane Grant
673a04398b
docs(start): Remove unplanned feature from docs (#4150) 2025-05-12 00:37:47 +02:00
Tanner Linsley
14be184843 release: v1.120.3 v1.20.3-alpha.0 v1.120.3 2025-05-08 21:15:31 +00:00
Christopher Horobin
32511d11c7
perf: improve type checking performance of Route.Link (#4117) 2025-05-08 23:14:15 +02:00
Tanner Linsley
163aaa33f2 release: v1.120.2 v1.120.2 2025-05-06 23:32:39 +00:00
Christopher Horobin
f6be2df066
perf: improve ts perf for Route.Link (#4104) 2025-05-07 01:31:10 +02:00
Andy Kiesler
144a33c48e
docs(router): normalize heading level for "Effect" in search guide (#4100) 2025-05-07 10:56:27 +12:00
Tanner Linsley
3ab84a8d73 release: v1.120.1 v1.120.1 2025-05-06 20:13:30 +00:00
Christopher Horobin
2c37ce289e
fix: use this.fullPath instead of useRouter (#4099) 2025-05-06 22:12:14 +02:00
Tanner Linsley
468edac9f1 release: v1.120.0 v1.120.0 2025-05-06 19:48:31 +00:00
Christopher Horobin
5eeb123381
feat: add bindings for Route.Link and routeApi.Link (#4095)
This allows `Route.Link` and `routeApi.Link` bindings instead of manual
`from`.

We never used to be able to do this due to circular issues but it seems
this is no longer an issue since all the changes to the types

---------

Co-authored-by: TkDodo <office@dorfmeister.cc>
2025-05-06 21:47:14 +02:00
Miro Rauhala
f0dbf0a124
docs(router): update working in the "route-trees" guide (#4091) 2025-05-06 10:38:59 +12:00
Sean Cassiere
697bca0fb1
test(directive-functions-plugin): add yields to generators (#4096) 2025-05-06 10:29:34 +12:00
Ilya Komichev
409252e947
docs(start): fix typos in logos (#4090) 2025-05-06 10:15:09 +12:00
Shruti Kapoor
ba8a1c836d
Adding Tutorial for Reading and Writing a File (#4089)
# Add DevJokes Tutorial: Reading and Writing Files
<img width="1318" alt="image"
src="https://github.com/user-attachments/assets/e6284dea-9596-42e5-b37a-c29ed56fa934"
/>

## Description
Adds a tutorial showing how to build a full-stack DevJokes app with
TanStack Start. Users learn to create server functions for reading and
writing to files, build React components, and implement data fetching
with TanStack Router.

## Key Features
- Server functions with `createServerFn`
- File-based data storage with Node.js `fs`
- Form handling and data validation
- Data refreshing with `router.invalidate()`
- Complete UI with Tailwind CSS

## Demo
https://youtu.be/zd0rtKbtlgU

## Reference
Complete code available at: https://github.com/shrutikapoor08/devjokes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-05-05 08:23:49 -06:00
ihaback
8672ec7b04
chore(examples): match env.example with config for authenticated-routes-firebase (#4079) 2025-05-05 03:38:25 +12:00
allen
42156fb226
fix the uptdated link for file base routing (#4085)
self explanatory
2025-05-04 14:23:30 +02:00
Tanner Linsley
c1ad053069 release: v1.119.2 v1.119.2 2025-05-04 01:47:06 +00:00
Sean Cassiere
d2a1a04534
fix(directive-functions-plugin): do not exclude generator functions (#4080) 2025-05-04 13:45:39 +12:00
Chukwuka Morka
191a1c8a2b
docs(router): walkthrough on using the ignore prefix for component colocation in the routing-concepts guide (#4075)
Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-05-02 10:17:05 +12:00
Chukwuka Morka
5e08ac5d74
docs(router): add ignore prefix into the file naming conventions guide (#4074)
Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-05-02 10:16:52 +12:00
Max Zhang
eb649e79de
docs(start): fix typos in the hosting guide (#4073) 2025-05-01 14:26:59 +12:00
Tanner Linsley
d4aaf7eaa3 release: v1.119.1 v1.119.1 2025-04-30 13:12:53 +00:00
Gianmarco Rengucci
1cfb6e26c9
fix(react-router-devtools): remove useRouter warning for panel (#4070)
This PR removes the warning to align the two
devtools implementations.
2025-05-01 01:04:25 +12:00
Tanner Linsley
91ae17d7ea release: v1.119.0 v1.119.0 2025-04-30 09:45:19 +00:00
scarf
12eb1426fe
feat(router-devtools-core): add navigation link to route (#4048)
Add a button to navigate to a route from the `router-devtools`.

Paths with dynamic path parameters will reuse the path parameters
from the current route. Only paths, where the current path
parameters are viable for a successful navigation will have this button
appear.

---

Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-04-30 21:20:39 +12:00
Ionut-Cristian Florescu
285cff7bbd
docs(start): fix key on changing the base path for API routes (#4062) 2025-04-30 18:35:26 +12:00