@tanstack/react-start-client 1.168.16 → 1.168.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,10 +3,8 @@ import { hydrateStart } from "@tanstack/start-client-core/client";
3
3
  /**
4
4
  * React-specific wrapper for hydrateStart that signals hydration completion
5
5
  */
6
- async function hydrateStart$1() {
7
- const router = await hydrateStart();
8
- window.$_TSR?.h();
9
- return router;
6
+ function hydrateStart$1() {
7
+ return hydrateStart().finally(() => window.$_TSR?.h());
10
8
  }
11
9
  //#endregion
12
10
  export { hydrateStart$1 as hydrateStart };
@@ -1 +1 @@
1
- {"version":3,"file":"hydrateStart.js","names":[],"sources":["../../src/hydrateStart.ts"],"sourcesContent":["import { hydrateStart as coreHydrateStart } from '@tanstack/start-client-core/client'\nimport type { AnyRouter } from '@tanstack/router-core'\n\n/**\n * React-specific wrapper for hydrateStart that signals hydration completion\n */\nexport async function hydrateStart(): Promise<AnyRouter> {\n const router = await coreHydrateStart()\n // Signal that router hydration is complete so cleanup can happen if stream has ended\n window.$_TSR?.h()\n return router\n}\n"],"mappings":";;;;;AAMA,eAAsB,iBAAmC;CACvD,MAAM,SAAS,MAAM,aAAiB;CAEtC,OAAO,OAAO,EAAE;CAChB,OAAO;AACT"}
1
+ {"version":3,"file":"hydrateStart.js","names":[],"sources":["../../src/hydrateStart.ts"],"sourcesContent":["import { hydrateStart as coreHydrateStart } from '@tanstack/start-client-core/client'\nimport type { AnyRouter } from '@tanstack/router-core'\n\n/**\n * React-specific wrapper for hydrateStart that signals hydration completion\n */\nexport function hydrateStart(): Promise<AnyRouter> {\n return coreHydrateStart().finally(() => window.$_TSR?.h())\n}\n"],"mappings":";;;;;AAMA,SAAgB,iBAAmC;CACjD,OAAO,aAAiB,EAAE,cAAc,OAAO,OAAO,EAAE,CAAC;AAC3D"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-start-client",
3
- "version": "1.168.16",
3
+ "version": "1.168.17",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -55,9 +55,9 @@
55
55
  "node": ">=22.12.0"
56
56
  },
57
57
  "dependencies": {
58
- "@tanstack/react-router": "1.170.18",
59
- "@tanstack/router-core": "1.171.15",
60
- "@tanstack/start-client-core": "1.170.14"
58
+ "@tanstack/react-router": "1.170.19",
59
+ "@tanstack/router-core": "1.171.16",
60
+ "@tanstack/start-client-core": "1.170.15"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@testing-library/react": "^16.2.0",
@@ -76,12 +76,12 @@
76
76
  "test:unit:dev": "vitest --watch",
77
77
  "test:eslint": "eslint ./src",
78
78
  "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
79
- "test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
80
79
  "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
81
80
  "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
82
81
  "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
83
82
  "test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js",
84
- "test:types:ts60": "tsc",
83
+ "test:types:ts60": "tsc6",
84
+ "test:types:ts70": "tsc",
85
85
  "test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
86
86
  "build": "vite build"
87
87
  }
@@ -4,9 +4,6 @@ import type { AnyRouter } from '@tanstack/router-core'
4
4
  /**
5
5
  * React-specific wrapper for hydrateStart that signals hydration completion
6
6
  */
7
- export async function hydrateStart(): Promise<AnyRouter> {
8
- const router = await coreHydrateStart()
9
- // Signal that router hydration is complete so cleanup can happen if stream has ended
10
- window.$_TSR?.h()
11
- return router
7
+ export function hydrateStart(): Promise<AnyRouter> {
8
+ return coreHydrateStart().finally(() => window.$_TSR?.h())
12
9
  }
@@ -0,0 +1,33 @@
1
+ import { afterEach, expect, test, vi } from 'vitest'
2
+ import { hydrateStart } from '../hydrateStart'
3
+
4
+ const coreHydrateStart = vi.hoisted(() => vi.fn())
5
+
6
+ vi.mock('@tanstack/start-client-core/client', () => ({
7
+ hydrateStart: coreHydrateStart,
8
+ }))
9
+
10
+ afterEach(() => {
11
+ delete window.$_TSR
12
+ coreHydrateStart.mockReset()
13
+ })
14
+
15
+ test('signals streaming cleanup after hydration succeeds', async () => {
16
+ const router = {}
17
+ coreHydrateStart.mockResolvedValue(router)
18
+ const hydrated = vi.fn()
19
+ window.$_TSR = { h: hydrated } as any
20
+
21
+ await expect(hydrateStart()).resolves.toBe(router)
22
+ expect(hydrated).toHaveBeenCalledTimes(1)
23
+ })
24
+
25
+ test('signals streaming cleanup without hiding a hydration failure', async () => {
26
+ const error = new Error('hydration failed')
27
+ coreHydrateStart.mockRejectedValue(error)
28
+ const hydrated = vi.fn()
29
+ window.$_TSR = { h: hydrated } as any
30
+
31
+ await expect(hydrateStart()).rejects.toBe(error)
32
+ expect(hydrated).toHaveBeenCalledTimes(1)
33
+ })