Closed mykola-vrmchk closed 8 months ago
I run into a problem of infinite cycles in my project. Here is a reproduction snippet
import { effect, signal, untracked } from '@preact/signals-core'; import { expect } from 'chai'; describe('Untracked', () => { it('Nested `untracked` does not cause effect to run', async () => { const thisSignal = signal({}); let updateCount = 0; untracked(() => { effect(() => { untracked(() => { const _ = thisSignal.value; thisSignal.value = {}; updateCount++; }); }); }); expect(updateCount).to.eq(1); }); });
The code above will produce an error Error: Cycle detected, it happens because nested untracked causes effect to run.
Error: Cycle detected
untracked
effect
I am wondering if this is expected behavior
This was recently fixed in #512 but a new version has not yet been released.
@jviide could you, please, estimate when the next release will be?
Closing as released and fixed
@JoviDeCroock awesome, thanks
I run into a problem of infinite cycles in my project. Here is a reproduction snippet
The code above will produce an error
Error: Cycle detected
, it happens because nesteduntracked
causeseffect
to run.I am wondering if this is expected behavior