@@ -13,7 +13,7 @@ import {
1313} from './runtime.js' ;
1414import { effect , teardown } from './reactivity/effects.js' ;
1515import { legacy_mode_flag } from '../flags/index.js' ;
16- import { CTX_CONTAINS_TEARDOWN , CTX_DESTROYED , TEARDOWN_PROPS } from './constants.js' ;
16+ import { CTX_DESTROYED , TEARDOWN_PROPS } from './constants.js' ;
1717import { define_property } from '../shared/utils.js' ;
1818
1919/** @type {ComponentContext | null } */
@@ -136,24 +136,27 @@ export function push(props, runes = false, fn) {
136136 }
137137
138138 teardown ( ( ) => {
139- if ( ( ctx . f & ( CTX_CONTAINS_TEARDOWN | CTX_DESTROYED ) ) = == 0 ) {
139+ if ( ( ctx . f & CTX_DESTROYED ) ! == 0 ) {
140140 return ;
141141 }
142142 // Mark the context as destroyed, so any derived props can use
143143 // the latest known value before teardown
144144 ctx . f ^= CTX_DESTROYED ;
145145
146- var teardown_props = ctx . tp ;
147- if ( TEARDOWN_PROPS in props ) {
148- props [ TEARDOWN_PROPS ] = teardown_props ;
149- return ;
150- }
151- // Apply the latest known props before teardown over existing props
152- for ( var key in teardown_props ) {
153- define_property ( props , key , {
154- value : teardown_props [ key ] ,
155- configurable : true
156- } ) ;
146+ // Only apply the latest known props before teardown in legacy mode
147+ if ( ! is_runes ( ) ) {
148+ var teardown_props = ctx . tp ;
149+ if ( TEARDOWN_PROPS in props ) {
150+ props [ TEARDOWN_PROPS ] = teardown_props ;
151+ return ;
152+ }
153+ // Apply the latest known props before teardown over existing props
154+ for ( var key in teardown_props ) {
155+ define_property ( props , key , {
156+ value : teardown_props [ key ] ,
157+ configurable : true
158+ } ) ;
159+ }
157160 }
158161 } ) ;
159162
@@ -198,11 +201,12 @@ export function pop(component) {
198201 }
199202 context_stack_item . m = true ;
200203
201- effect ( ( ) => {
202- if ( ( context_stack_item . f & CTX_CONTAINS_TEARDOWN ) !== 0 ) {
204+ // Only apply the latest known props before teardown in legacy mode
205+ if ( ! is_runes ( ) ) {
206+ effect ( ( ) => {
203207 context_stack_item . tp = { ...context_stack_item . s } ;
204- }
205- } ) ;
208+ } ) ;
209+ }
206210 }
207211 // Micro-optimization: Don't set .a above to the empty object
208212 // so it can be garbage-collected when the return here is unused
0 commit comments