Skip to content

Commit e64e881

Browse files
committed
Cleanup
1 parent 3336432 commit e64e881

2 files changed

Lines changed: 5 additions & 21 deletions

File tree

‎docs/router/guide/document-head-management.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export const Route = createFileRoute('/product/$slug')({
219219
}),
220220
},
221221
]),
222-
]),
222+
],
223223
}),
224224
// Body scripts can be deferred too — useful when the script's URL or
225225
// payload depends on loader data, e.g. a tenant-specific analytics ID

‎packages/router-core/tests/deferred-head-loading.test.ts‎

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ describe('executeHead: client re-evaluation through loadMatches', () => {
236236
],
237237
}
238238
}
239-
// Re-eval pass returns a brand-new unresolved promise that the
240-
// awaitClient=true path must await before updating the match.
241239
return {
242240
meta: [{ name: 'static', content: 'present' }, secondPromise],
243241
}
@@ -261,20 +259,14 @@ describe('executeHead: client re-evaluation through loadMatches', () => {
261259

262260
const indexMatchId = router.state.matches.find((m) => m.routeId === '/')!.id
263261

264-
// Trigger re-evaluation by resolving the original deferred promise.
265262
originalPromise.resolve({ title: 'unused' })
266-
// Yield enough microtasks for the re-eval to start and call head() again,
267-
// but not enough for it to finish (secondPromise is still pending).
268263
await new Promise((r) => setTimeout(r, 10))
269264

270265
expect(headFn).toHaveBeenCalledTimes(2)
271-
// Match should still hold the first-pass static entries; re-eval is
272-
// blocked on secondPromise.
273266
expect(router.getMatch(indexMatchId)!.meta).toEqual([
274267
{ name: 'static', content: 'present' },
275268
])
276269

277-
// Resolve the new promise — re-eval should now finish and commit it.
278270
secondPromise.resolve([{ title: 'second-pass' }])
279271
await new Promise((r) => setTimeout(r, 10))
280272

@@ -489,8 +481,7 @@ describe('attachRouterServerSsrUtils: automatic bot detection', () => {
489481
manifest: undefined,
490482
request: new Request('http://localhost/'),
491483
})
492-
// isbot only flags a UA when it matches a known crawler signature;
493-
// an absent/empty UA is treated as a non-bot client.
484+
// isbot treats an absent/empty UA as a non-bot client.
494485
expect(router.serverSsr.isBot).toBe(false)
495486
})
496487

@@ -501,11 +492,9 @@ describe('attachRouterServerSsrUtils: automatic bot detection', () => {
501492
})
502493
})
503494

504-
// `hydrate` mirrors `executeHead`: the first pass commits only static head
505-
// entries so hydration is never blocked by a pending loader promise. If any
506-
// field carried a promise, a `Promise.allSettled`-driven re-evaluation pass
507-
// re-runs head()/scripts() and commits the resolved values through the store
508-
// so `<HeadContent />` / `<Scripts />` subscribers see them.
495+
// Mirrors `executeHead`: first pass commits only static entries so hydration
496+
// is never blocked by a pending promise. A re-evaluation pass commits resolved
497+
// values through the store once deferred promises settle.
509498
describe('hydrate: deferred head loading', () => {
510499
let mockWindow: { $_TSR?: TsrSsrGlobal }
511500
let dataPromise: ReturnType<
@@ -592,9 +581,6 @@ describe('hydrate: deferred head loading', () => {
592581
}
593582

594583
it('does not block hydration on a still-pending deferred head promise', async () => {
595-
// A non-Start consumer hands hydrate a loader whose deferred promise
596-
// has not yet settled. Hydrate must complete immediately and let the
597-
// re-evaluation pass commit the resolved values when they arrive.
598584
const mockMatches = setupDehydrated({ dataPromise })
599585

600586
let hydrationDone = false
@@ -608,8 +594,6 @@ describe('hydrate: deferred head loading', () => {
608594
expect(hydrationDone).toBe(true)
609595
await hydratePromise
610596

611-
// First pass committed static entries only — re-eval is queued behind
612-
// the still-pending dataPromise.
613597
expect(mockMatches[0].meta).toEqual([
614598
{ name: 'static', content: 'present' },
615599
])

0 commit comments

Comments
 (0)