File tree Expand file tree Collapse file tree
tests/cypress/integration/directives Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { html , test } from '../../utils'
2+
3+ test ( 'effects that trigger each other do not requeue endlessly in the same flush' ,
4+ [ html `
5+ < div x-data ="{ a: 0, b: 0 } ">
6+ < button @click ="window.__allowCircularEffects = true; a++ "> start</ button >
7+
8+ < span x-effect ="a; if (window.__allowCircularEffects) { if (++window.__circularEffectRuns > 4) throw new Error('Circular effects requeued endlessly'); b++ } "> </ span >
9+ < span x-effect ="b; if (window.__allowCircularEffects) { if (++window.__circularEffectRuns > 4) throw new Error('Circular effects requeued endlessly'); a++ } "> </ span >
10+ </ div >
11+ ` ,
12+ `
13+ window.__allowCircularEffects = false
14+ window.__circularEffectRuns = 0
15+ ` ] ,
16+ ( { get } ) => {
17+ get ( 'button' ) . click ( )
18+ }
19+ )
You can’t perform that action at this time.
0 commit comments