Skip to content

Commit 47786c5

Browse files
authored
Merge branch 'main' into start-client-core-disable-import-order-rule
2 parents 8c50228 + f07d6ad commit 47786c5

File tree

397 files changed

+2204
-1084
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

397 files changed

+2204
-1084
lines changed

docs/router/framework/react/guide/type-safety.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const parentRoute = createRoute({
2626

2727
## Exported Hooks, Components, and Utilities
2828

29-
For the types of your router to work with top-level exports like `Link`, `useNavigate`, `useParams`, etc. they must permeate the type-script module boundary and be registered right into the library. To do this, we use declaration merging on the exported `Register` interface.
29+
For the types of your router to work with top-level exports like `Link`, `useNavigate`, `useParams`, etc. they must permeate the TypeScript module boundary and be registered right into the library. To do this, we use declaration merging on the exported `Register` interface.
3030

3131
```ts
3232
const router = createRouter({

docs/start/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@
334334
"label": "Basic + Static rendering",
335335
"to": "framework/solid/examples/start-basic-static"
336336
},
337+
{
338+
"label": "Basic + Supabase",
339+
"to": "framework/solid/examples/start-basic-supabase"
340+
},
337341
{
338342
"label": "Cloudflare Vite Plugin",
339343
"to": "framework/solid/examples/start-basic-cloudflare"

docs/start/framework/react/guide/observability.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ import {
519519
defaultStreamHandler,
520520
defineHandlerCallback,
521521
} from '@tanstack/react-start/server'
522+
import type { ServerEntry } from '@tanstack/react-start/server-entry'
522523

523524
const customHandler = defineHandlerCallback(async (ctx) => {
524525
// We do this so that transactions are grouped under the route ID instead of unique URLs
@@ -538,11 +539,11 @@ const customHandler = defineHandlerCallback(async (ctx) => {
538539
})
539540

540541
export default {
541-
fetch(request: Request) {
542+
fetch(request) {
542543
const handler = createStartHandler(customHandler)
543544
return handler(request)
544545
},
545-
}
546+
} satisfies ServerEntry
546547
```
547548

548549
```bash

docs/start/framework/react/guide/server-entry-point.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ This is done via the `src/server.ts` file.
1212

1313
```tsx
1414
// src/server.ts
15-
import handler from '@tanstack/react-start/server-entry'
15+
import handler, { type ServerEntry } from '@tanstack/react-start/server-entry'
1616

1717
export default {
18-
fetch(request: Request) {
18+
fetch(request) {
1919
return handler.fetch(request)
2020
},
21-
}
21+
} satisfies ServerEntry
2222
```
2323

24-
The entry point must conform to the following interface:
24+
The default export must conform to the `ServerEntry` interface:
2525

26-
```tsx
26+
```ts
2727
export default {
28-
fetch(req: Request): Promise<Response> {
28+
fetch(req: Request, opts?: RequestOptions): Promise<Response> {
2929
// ...
3030
},
3131
}
@@ -44,6 +44,7 @@ import {
4444
defaultStreamHandler,
4545
defineHandlerCallback,
4646
} from '@tanstack/react-start/server'
47+
import type { ServerEntry } from '@tanstack/react-start/server-entry'
4748

4849
const customHandler = defineHandlerCallback((ctx) => {
4950
// add custom logic here
@@ -54,7 +55,7 @@ const fetch = createStartHandler(customHandler)
5455

5556
export default {
5657
fetch,
57-
}
58+
} satisfies ServerEntry
5859
```
5960

6061
## Request context
@@ -64,7 +65,7 @@ When your server needs to pass additional, typed data into request handlers (for
6465
To add types for your request context, augment the `Register` interface from `@tanstack/react-start` with a `server.requestContext` property. The runtime `context` you pass to `handler.fetch` will then match that type. Example:
6566

6667
```tsx
67-
import handler from '@tanstack/react-start/server-entry'
68+
import handler, { type ServerEntry } from '@tanstack/react-start/server-entry'
6869

6970
type MyRequestContext = {
7071
hello: string
@@ -80,10 +81,10 @@ declare module '@tanstack/react-start' {
8081
}
8182

8283
export default {
83-
async fetch(request: Request): Promise<Response> {
84+
async fetch(request) {
8485
return handler.fetch(request, { context: { hello: 'world', foo: 123 } })
8586
},
86-
}
87+
} satisfies ServerEntry
8788
```
8889

8990
## Server Configuration

docs/start/framework/solid/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: Getting Started
77

88
Choose one of the following options to start building a _new_ TanStack Start project:
99

10-
- [TanStack Start CLI] - Just run `npm create @tanstack/start@latest`. Local, fast, and optionally customizable
10+
- [TanStack Start CLI] - Just run `npm create @tanstack/start@latest -- --framework solid`. Local, fast, and optionally customizable
1111
- [TanStack Builder](#) (coming soon!) - A visual interface to configure new TanStack projects with a few clicks
1212
- [Quick Start Examples](../quick-start) Download or clone one of our official examples
1313
- [Build a project from scratch](../build-from-scratch) - A guide to building a TanStack Start project line-by-line, file-by-file.

docs/start/framework/solid/quick-start.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ title: Quick Start
88
The fastest way to get a Start project up and running is with the cli. Just run
99

1010
```
11-
pnpm create @tanstack/start@latest
11+
pnpm create @tanstack/start@latest --framework solid
1212
```
1313

1414
or
1515

1616
```
17-
npm create @tanstack/start@latest
17+
npm create @tanstack/start@latest -- --framework solid
1818
```
1919

2020
depending on your package manage of choice. You'll be prompted to add things like Tailwind, eslint, and a ton of other options.

e2e/react-router/basic-file-based/tests/app.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ test('Should not remount deps when remountDeps does not change ', async ({
296296
await expect(page.getByTestId('component-mounts')).toContainText(
297297
'Page component mounts: 1',
298298
)
299+
await page.getByRole('button', { name: 'Regenerate search param' }).click()
300+
await expect(page.getByTestId('component-mounts')).toContainText(
301+
'Page component mounts: 1',
302+
)
299303
})
300304

301305
test('Should remount deps when remountDeps does change ', async ({ page }) => {
@@ -307,4 +311,8 @@ test('Should remount deps when remountDeps does change ', async ({ page }) => {
307311
await expect(page.getByTestId('component-mounts')).toContainText(
308312
'Page component mounts: 2',
309313
)
314+
await page.getByRole('button', { name: 'Regenerate search param' }).click()
315+
await expect(page.getByTestId('component-mounts')).toContainText(
316+
'Page component mounts: 3',
317+
)
310318
})

e2e/solid-router/basic-file-based/tests/app.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ test('Should not remount deps when remountDeps does not change ', async ({
284284
await expect(page.getByTestId('component-mounts')).toContainText(
285285
'Page component mounts: 1',
286286
)
287+
await page.getByRole('button', { name: 'Regenerate search param' }).click()
288+
await expect(page.getByTestId('component-mounts')).toContainText(
289+
'Page component mounts: 1',
290+
)
287291
})
288292

289293
test('Should remount deps when remountDeps does change ', async ({ page }) => {
@@ -295,4 +299,8 @@ test('Should remount deps when remountDeps does change ', async ({ page }) => {
295299
await expect(page.getByTestId('component-mounts')).toContainText(
296300
'Page component mounts: 2',
297301
)
302+
await page.getByRole('button', { name: 'Regenerate search param' }).click()
303+
await expect(page.getByTestId('component-mounts')).toContainText(
304+
'Page component mounts: 3',
305+
)
298306
})

e2e/solid-router/basic-file-based/tests/params.spec.ts

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -56,81 +56,6 @@ test.describe('ensure single params have been parsed correctly whilst being stab
5656
}
5757
})
5858

59-
test('ensure only applicable params are returned and updated with multiple params', async ({
60-
page,
61-
}) => {
62-
await page.goto('/params-ps/named/foo')
63-
await page.waitForLoadState('networkidle')
64-
65-
const pagePathname = new URL(page.url()).pathname
66-
expect(pagePathname).toBe('/params-ps/named/foo')
67-
68-
const fooRenderCount = page.getByTestId('foo-render-count')
69-
const fooIndexLink = page.getByTestId('params-foo-links-index')
70-
const fooBar1Link = page.getByTestId('params-foo-links-bar1')
71-
const fooBar2Link = page.getByTestId('params-foo-links-bar2')
72-
const fooBarBazLink = page.getByTestId('params-foo-bar-links-baz')
73-
const fooValue = page.getByTestId('params-output')
74-
const fooBarValue = page.getByTestId('foo-bar-value')
75-
const fooBazInBarValue = page.getByTestId('foo-baz-in-bar-value')
76-
const fooBarRenderCount = page.getByTestId('foo-bar-render-count')
77-
const fooBazInBarRenderCount = page.getByTestId('foo-baz-in-bar-render-count')
78-
const fooBarBazValue = page.getByTestId('foo-bar-baz-value')
79-
80-
await expect(fooRenderCount).toBeInViewport()
81-
await expect(fooValue).toBeInViewport()
82-
await expect(fooIndexLink).toBeInViewport()
83-
await expect(fooBar1Link).toBeInViewport()
84-
await expect(fooBar2Link).toBeInViewport()
85-
await expect(fooRenderCount).toHaveText('1')
86-
await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))
87-
88-
await fooBar1Link.click()
89-
await page.waitForLoadState('networkidle')
90-
await expect(fooValue).toBeInViewport()
91-
await expect(fooRenderCount).toBeInViewport()
92-
await expect(fooBarRenderCount).toBeInViewport()
93-
await expect(fooBarValue).toBeInViewport()
94-
await expect(fooBazInBarValue).toBeInViewport()
95-
await expect(fooBarBazLink).toBeInViewport()
96-
await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))
97-
await expect(fooRenderCount).toHaveText('1')
98-
await expect(fooBarRenderCount).toHaveText('1')
99-
await expect(fooBarValue).toHaveText('1')
100-
await expect(fooBazInBarValue).toHaveText('no param')
101-
await expect(fooBazInBarRenderCount).toHaveText('1')
102-
103-
await fooBarBazLink.click()
104-
await page.waitForLoadState('networkidle')
105-
await expect(fooValue).toBeInViewport()
106-
await expect(fooRenderCount).toBeInViewport()
107-
await expect(fooBarRenderCount).toBeInViewport()
108-
await expect(fooBarValue).toBeInViewport()
109-
await expect(fooBazInBarValue).toBeInViewport()
110-
await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))
111-
await expect(fooRenderCount).toHaveText('1')
112-
await expect(fooBarRenderCount).toHaveText('1')
113-
await expect(fooBarValue).toHaveText('1')
114-
await expect(fooBazInBarValue).toHaveText('1_10')
115-
await expect(fooBarBazValue).toHaveText('1_10')
116-
await expect(fooBazInBarRenderCount).toHaveText('2')
117-
118-
await fooBar2Link.click()
119-
await expect(fooValue).toBeInViewport()
120-
await expect(fooRenderCount).toBeInViewport()
121-
await expect(fooBarValue).toBeInViewport()
122-
await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))
123-
await expect(fooRenderCount).toHaveText('1')
124-
await expect(fooBarValue).toHaveText('2')
125-
126-
await fooIndexLink.click()
127-
await expect(fooValue).toBeInViewport()
128-
await expect(fooRenderCount).toBeInViewport()
129-
await expect(fooBarValue).not.toBeInViewport()
130-
await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))
131-
await expect(fooRenderCount).toHaveText('1')
132-
})
133-
13459
test.describe('params operations + non-nested routes', () => {
13560
test.beforeEach(async ({ page }) => {
13661
await page.goto('/params-ps/non-nested')
@@ -147,9 +72,9 @@ test.describe('params operations + non-nested routes', () => {
14772
'href',
14873
'/params-ps/non-nested/foo/bar',
14974
)
75+
15076
await fooBarLink.click()
15177
await page.waitForURL('/params-ps/non-nested/foo/bar')
152-
15378
const pagePathname = new URL(page.url()).pathname
15479
expect(pagePathname).toBe('/params-ps/non-nested/foo/bar')
15580

@@ -320,7 +245,7 @@ test.describe('params operations + prefix/suffix', () => {
320245
await expect(fooBazInBarValue).toBeInViewport()
321246
await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))
322247
await expect(fooRenderCount).toHaveText('1')
323-
await expect(fooBarRenderCount).toHaveText('1')
248+
await expect(fooBarRenderCount).toHaveText('2')
324249
await expect(fooBarValue).toHaveText('1')
325250
await expect(fooBazInBarValue).toHaveText('1_10')
326251
await expect(fooBarBazValue).toHaveText('1_10')

e2e/solid-router/basic/src/main.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Link,
66
Outlet,
77
RouterProvider,
8+
createLink,
89
createRootRoute,
910
createRoute,
1011
createRouter,
@@ -28,6 +29,7 @@ const rootRoute = createRootRoute({
2829
})
2930

3031
function RootComponent() {
32+
const SvgLink = createLink('svg')
3133
return (
3234
<>
3335
<HeadContent />
@@ -71,7 +73,23 @@ function RootComponent() {
7173
}}
7274
>
7375
This Route Does Not Exist
74-
</Link>
76+
</Link>{' '}
77+
<div class="flex items-center">
78+
<svg width="20" height="20" viewBox="0 0 20 20" role="img">
79+
<title id="rectTitle">Link in SVG</title>
80+
<SvgLink to="/posts" aria-label="Open posts from SVG">
81+
<rect
82+
x="0"
83+
y="0"
84+
width="20"
85+
height="20"
86+
rx="4"
87+
fill="blue"
88+
stroke-width="2"
89+
/>
90+
</SvgLink>
91+
</svg>
92+
</div>
7593
</div>
7694
<Outlet />
7795
<TanStackRouterDevtools position="bottom-right" />

0 commit comments

Comments
 (0)