@@ -145,7 +145,7 @@ function trapGet(target, prop) {
145145 }
146146 return values [ prop ] ;
147147 }
148- if ( ! target . keysSealed ) { target . keySetVersion . depend ( ) ; }
148+ if ( ! target . keysSealed ) { ( target . keySetVersion ??= new Dependency ( ) ) . depend ( ) ; }
149149 return target . parent [ prop ] ;
150150}
151151
@@ -269,7 +269,11 @@ export class ReactiveDataContext {
269269 // userland breaks Signal.equalityFunction after this RDC is live,
270270 // both Signal and RDC fail the same way; no divergence.
271271 this . equalityFunction = Signal . equalityFunction ;
272- this . keySetVersion = new Dependency ( ) ;
272+ // Lazy: only a reader falling through on the unsealed path allocates it
273+ // (spread-mode late keys). as-mode reads run post-seal, so it stays null —
274+ // the per-row saving. A writer fires it only if a reader already created it
275+ // (a changed() on a never-subscribed dep was always a no-op).
276+ this . keySetVersion = null ;
273277 this . proxy = new Proxy ( this , HANDLER ) ;
274278
275279 if ( registerItemContext ) {
@@ -288,7 +292,7 @@ export class ReactiveDataContext {
288292 if ( key !== this . asKey || value === null || typeof value !== 'object' ) {
289293 this . deps [ key ] = new Dependency ( ) ;
290294 }
291- if ( ! this . keysSealed ) { this . keySetVersion . changed ( ) ; }
295+ if ( ! this . keysSealed && this . keySetVersion !== null ) { this . keySetVersion . changed ( ) ; }
292296 return ;
293297 }
294298 const old = this . values [ key ] ;
0 commit comments