@tanstack/solid-start-client
Advanced tools
| export {}; |
| import { afterEach, expect, test, vi } from 'vitest' | ||
| import { hydrateStart } from '../hydrateStart' | ||
| const coreHydrateStart = vi.hoisted(() => vi.fn()) | ||
| vi.mock('@tanstack/start-client-core/client', () => ({ | ||
| hydrateStart: coreHydrateStart, | ||
| })) | ||
| afterEach(() => { | ||
| delete window.$_TSR | ||
| coreHydrateStart.mockReset() | ||
| }) | ||
| test('signals streaming cleanup after hydration succeeds', async () => { | ||
| const router = {} | ||
| coreHydrateStart.mockResolvedValue(router) | ||
| const hydrated = vi.fn() | ||
| window.$_TSR = { h: hydrated } as any | ||
| await expect(hydrateStart()).resolves.toBe(router) | ||
| expect(hydrated).toHaveBeenCalledTimes(1) | ||
| }) | ||
| test('signals streaming cleanup without hiding a hydration failure', async () => { | ||
| const error = new Error('hydration failed') | ||
| coreHydrateStart.mockRejectedValue(error) | ||
| const hydrated = vi.fn() | ||
| window.$_TSR = { h: hydrated } as any | ||
| await expect(hydrateStart()).rejects.toBe(error) | ||
| expect(hydrated).toHaveBeenCalledTimes(1) | ||
| }) |
@@ -6,6 +6,4 @@ import { hydrateStart } from "@tanstack/start-client-core/client"; | ||
| */ | ||
| async function hydrateStart$1() { | ||
| const router = await hydrateStart(); | ||
| window.$_TSR?.h(); | ||
| return router; | ||
| function hydrateStart$1() { | ||
| return hydrateStart().finally(() => window.$_TSR?.h()); | ||
| } | ||
@@ -12,0 +10,0 @@ //#endregion |
@@ -1,1 +0,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 * Solid-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"} | ||
| {"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 * Solid-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"} |
+9
-9
| { | ||
| "name": "@tanstack/solid-start-client", | ||
| "version": "2.0.0-beta.29", | ||
| "version": "2.0.0-beta.30", | ||
| "description": "Modern and scalable routing for Solid applications", | ||
@@ -58,13 +58,13 @@ "author": "Tanner Linsley", | ||
| "dependencies": { | ||
| "@tanstack/router-core": "1.171.14", | ||
| "@tanstack/solid-router": "2.0.0-beta.29", | ||
| "@tanstack/start-client-core": "1.170.13" | ||
| "@tanstack/router-core": "1.171.16", | ||
| "@tanstack/solid-router": "2.0.0-beta.30", | ||
| "@tanstack/start-client-core": "1.170.15" | ||
| }, | ||
| "devDependencies": { | ||
| "@solidjs/testing-library": "^0.8.10", | ||
| "@solidjs/web": "2.0.0-beta.29", | ||
| "@solidjs/web": "2.0.0-beta.32", | ||
| "@testing-library/jest-dom": "^6.6.3", | ||
| "solid-js": "2.0.0-beta.29", | ||
| "solid-js": "2.0.0-beta.32", | ||
| "vite": "*", | ||
| "vite-plugin-solid": "^3.0.0-next.21" | ||
| "vite-plugin-solid": "^3.0.0-next.23" | ||
| }, | ||
@@ -82,3 +82,2 @@ "peerDependencies": { | ||
| "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"", | ||
| "test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js", | ||
| "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js", | ||
@@ -88,3 +87,4 @@ "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js", | ||
| "test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js", | ||
| "test:types:ts60": "tsc", | ||
| "test:types:ts60": "tsc6", | ||
| "test:types:ts70": "tsc", | ||
| "test:build": "publint --strict && attw --ignore-rules no-resolution --pack .", | ||
@@ -91,0 +91,0 @@ "build": "vite build" |
@@ -7,7 +7,4 @@ import { hydrateStart as coreHydrateStart } from '@tanstack/start-client-core/client' | ||
| */ | ||
| export async function hydrateStart(): Promise<AnyRouter> { | ||
| const router = await coreHydrateStart() | ||
| // Signal that router hydration is complete so cleanup can happen if stream has ended | ||
| window.$_TSR?.h() | ||
| return router | ||
| export function hydrateStart(): Promise<AnyRouter> { | ||
| return coreHydrateStart().finally(() => window.$_TSR?.h()) | ||
| } |
73362
0.93%53
3.92%1178
1.9%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed