@@ -10,7 +10,6 @@ import { BLOCK_CLOSE, BLOCK_OPEN } from './hydration.js';
1010import { attributes } from './index.js' ;
1111import { get_render_context , with_render_context , init_render_context } from './render-context.js' ;
1212import { DEV } from 'esm-env' ;
13- import { get_stack } from './dev.js' ;
1413
1514/** @typedef {'head' | 'body' } RendererType */
1615/** @typedef {{ [key in RendererType]: string } } AccumulatedContent */
@@ -578,22 +577,18 @@ export class Renderer {
578577 async #collect_hydratables( ) {
579578 const ctx = get_render_context ( ) . hydratable ;
580579
581- for ( const [ promise , key ] of ctx . unresolved_promises ) {
580+ for ( const [ _ , key ] of ctx . unresolved_promises ) {
582581 // this is a problem -- it means we've finished the render but we're still waiting on a promise to resolve so we can
583582 // serialize it, so we're blocking the response on useless content.
584- w . unresolved_hydratable (
585- key ,
586- ctx . lookup . get ( key ) ?. dev ?. stack ?? '<missing stack trace>' ,
587- await promise
588- ) ;
583+ w . unresolved_hydratable ( key , ctx . lookup . get ( key ) ?. dev ?. stack ?? '<missing stack trace>' ) ;
589584 }
590585
591586 for ( const comparison of ctx . comparisons ) {
592587 // these reject if there's a mismatch
593588 await comparison ;
594589 }
595590
596- return await Renderer . #hydratable_block( ctx , [ ] ) ;
591+ return await Renderer . #hydratable_block( ctx ) ;
597592 }
598593
599594 /**
@@ -652,10 +647,9 @@ export class Renderer {
652647
653648 /**
654649 * @param {HydratableContext } ctx
655- * @param {string[] } unused_keys
656650 */
657- static async #hydratable_block( ctx , unused_keys ) {
658- if ( ctx . lookup . size === 0 && unused_keys . length === 0 ) {
651+ static async #hydratable_block( ctx ) {
652+ if ( ctx . lookup . size === 0 ) {
659653 return null ;
660654 }
661655
@@ -672,11 +666,11 @@ export class Renderer {
672666 {
673667 const r = (v) => Promise.resolve(v);
674668 const v = [${ values . join ( ',' ) } ];
675- function d(i) {
669+ function d(i) {
676670 const value = v[i];
677671 return typeof value === 'function' ? value() : value;
678672 };
679- const sv = window.__svelte ??= {};${ Renderer . #used_hydratables( ctx . lookup ) } ${ Renderer . #unused_hydratables ( unused_keys ) }
673+ const sv = window.__svelte ??= {};${ Renderer . #used_hydratables( ctx . lookup ) }
680674 }
681675 </script>` ;
682676 }
@@ -693,16 +687,6 @@ export class Renderer {
693687 store.set(k, d(i));
694688 }` ;
695689 }
696-
697- /** @param {string[] } unused_keys */
698- static #unused_hydratables( unused_keys ) {
699- if ( unused_keys . length === 0 ) return '' ;
700- return `
701- const unused = sv.uh ??= new Set();
702- for (const k of ${ JSON . stringify ( unused_keys ) } ) {
703- unused.add(k);
704- }` ;
705- }
706690}
707691
708692export class SSRState {
0 commit comments