@@ -16,8 +16,9 @@ import {
16
16
update_effect ,
17
17
derived_sources ,
18
18
set_derived_sources ,
19
- flush_sync ,
20
- check_dirtiness
19
+ check_dirtiness ,
20
+ set_is_flushing_effect ,
21
+ is_flushing_effect
21
22
} from '../runtime.js' ;
22
23
import { equals , safe_equals } from './equality.js' ;
23
24
import {
@@ -170,23 +171,21 @@ export function set(source, value) {
170
171
171
172
if ( DEV && inspect_effects . size > 0 ) {
172
173
const inspects = Array . from ( inspect_effects ) ;
173
- if ( current_effect === null ) {
174
- // Triggering an effect sync can tear the signal graph, so to avoid this we need
175
- // to ensure the graph has been flushed before triggering any inspect effects.
176
- // Only needed when there's currently no effect, and flushing with one present
177
- // could have other unintended consequences, like effects running out of order.
178
- // This is expensive, but given this is a DEV mode only feature, it should be fine
179
- flush_sync ( ) ;
180
- }
181
- for ( const effect of inspects ) {
182
- // Mark clean inspect-effects as maybe dirty and then check their dirtiness
183
- // instead of just updating the effects - this way we avoid overfiring.
184
- if ( ( effect . f & CLEAN ) !== 0 ) {
185
- set_signal_status ( effect , MAYBE_DIRTY ) ;
186
- }
187
- if ( check_dirtiness ( effect ) ) {
188
- update_effect ( effect ) ;
174
+ var previously_flushing_effect = is_flushing_effect ;
175
+ set_is_flushing_effect ( true ) ;
176
+ try {
177
+ for ( const effect of inspects ) {
178
+ // Mark clean inspect-effects as maybe dirty and then check their dirtiness
179
+ // instead of just updating the effects - this way we avoid overfiring.
180
+ if ( ( effect . f & CLEAN ) !== 0 ) {
181
+ set_signal_status ( effect , MAYBE_DIRTY ) ;
182
+ }
183
+ if ( check_dirtiness ( effect ) ) {
184
+ update_effect ( effect ) ;
185
+ }
189
186
}
187
+ } finally {
188
+ set_is_flushing_effect ( previously_flushing_effect ) ;
190
189
}
191
190
inspect_effects . clear ( ) ;
192
191
}
0 commit comments