MCPcopy Create free account
hub / github.com/TanStack/query / onShellReady

Function onShellReady

examples/preact/ssr-streaming/server.js:59–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57
58 const { pipe, abort } = render({
59 onShellReady() {
60 res.status(200).set({ 'Content-Type': 'text/html' })
61 res.write(htmlStart)
62
63 const stream = pipe(res)
64
65 // `compression` buffers the response, so flush every chunk to keep it streaming
66 if (isProduction) {
67 stream.on('data', () => {
68 res.flush()
69 })
70 }
71 stream.on('end', () => {
72 clearTimeout(abortTimeout)
73 res.end(htmlEnd)
74 })
75 },
76 onError(error) {
77 console.error(error)
78 if (!res.headersSent) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected