Skip to content

Commit ef37315

Browse files
fix
1 parent b744547 commit ef37315

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎e2e/react-start/streaming-ssr/tests/query-heavy.spec.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ test.describe('Query heavy route (9 useSuspenseQuery)', () => {
136136
const html = await response.text()
137137
const endMarker = '$_TSR.e()'
138138
const endIndex = html.indexOf(endMarker)
139+
const slowAsyncPayloadIndex = html.indexOf('"slow-async-3"')
139140
const lastScriptOpen = html.lastIndexOf('<script', endIndex)
140141
const lastScriptClose = html.lastIndexOf('</script>', endIndex)
141142

142143
expect(endIndex).toBeGreaterThan(-1)
143144
expect(lastScriptOpen).toBeGreaterThan(lastScriptClose)
144-
expect(html.indexOf('slow-async')).toBeGreaterThan(-1)
145-
expect(html.indexOf('slow-async')).toBeLessThan(endIndex)
145+
expect(slowAsyncPayloadIndex).toBeGreaterThan(-1)
146+
expect(slowAsyncPayloadIndex).toBeLessThan(endIndex)
146147
expect(html.slice(lastScriptOpen, endIndex)).toContain('.return(void 0)')
147148
expect(endIndex).toBeLessThan(html.indexOf('</body>'))
148149
})

‎packages/router-core/src/ssr/handlerCallback.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export function createSsrStreamResponse<TRouter extends AnyRouter>(
4848

4949
try {
5050
await response.body!.cancel(reason)
51-
return
5251
} catch {
5352
// ignore; fallback cleanup below still releases router SSR state
5453
}

‎packages/router-core/tests/transformStreamWithRouter.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function makeRouter(opts: Partial<FakeServerSsr> = {}): {
4545
finishSerialization: () => void
4646
} {
4747
const cleanupCalls = { count: 0 }
48+
let cleanedUp = false
4849
let buffered = ''
4950
const injectedListeners: Array<() => void> = []
5051
const serializationListeners: Array<() => void> = []
@@ -74,7 +75,10 @@ function makeRouter(opts: Partial<FakeServerSsr> = {}): {
7475
},
7576
setRenderFinished: () => {},
7677
cleanup: () => {
78+
if (cleanedUp) return
79+
cleanedUp = true
7780
cleanupCalls.count++
81+
router.serverSsr = undefined
7882
},
7983
liftScriptBarrier: () => {},
8084
...opts,

0 commit comments

Comments
 (0)