@timber-js/app 0.2.0-alpha.47 → 0.2.0-alpha.48

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timber-js/app",
3
- "version": "0.2.0-alpha.47",
3
+ "version": "0.2.0-alpha.48",
4
4
  "description": "Vite-native React framework built for Servers and Serverless Platforms — correct HTTP semantics, real status codes, pages that work without JavaScript",
5
5
  "keywords": [
6
6
  "cloudflare-workers",
@@ -310,6 +310,28 @@ function bootstrap(runtimeConfig: typeof config): void {
310
310
  // Leaving the stream open is harmless: the page is being torn down.
311
311
  function onDOMContentLoaded(): void {
312
312
  if (isPageUnloading()) return;
313
+
314
+ // In dev mode, do NOT close the stream. React's RSC renderer
315
+ // includes debug owner/stack references ($1, $14, etc.) in the
316
+ // Flight payload that point to rows delivered through the debug
317
+ // channel, not the main Flight stream. The browser Flight client
318
+ // tracks these as pending chunks. Closing the stream with
319
+ // unresolved chunks triggers reportGlobalError("Connection closed")
320
+ // which kills the entire React tree.
321
+ //
322
+ // Leaving the stream open is harmless: React has already received
323
+ // all data rows and can hydrate fully. The pending debug chunks
324
+ // just remain unresolved (they're only used for React DevTools
325
+ // component stacks, not rendering).
326
+ //
327
+ // In production, debug rows are not emitted, so closing is safe.
328
+ if (process.env.NODE_ENV === 'development') {
329
+ // Mark as flushed so no more data is buffered, but don't close.
330
+ streamFlushed = true;
331
+ dataBuffer = undefined;
332
+ return;
333
+ }
334
+
313
335
  if (streamWriter && !streamFlushed) {
314
336
  streamWriter.close();
315
337
  streamFlushed = true;
@@ -212,7 +212,7 @@ export async function handleSsr(
212
212
  // (eliminates Promise-per-chunk overhead from Web Streams reader)
213
213
  // On Workers: createFromReadableStream (Web Streams are V8-native C++ there)
214
214
  let element: React.ReactNode;
215
- if (hasNodeStreamDecode && _nodeStreamImports) {
215
+ if (hasNodeStreamDecode && _nodeStreamImports) {
216
216
  const nodeRscStream = _nodeStreamImports.ReadableFromWeb(
217
217
  rscStream as import('stream/web').ReadableStream
218
218
  );