Closed
Description
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.
I am wondering if this is expected behavior
Metadata
Metadata
Assignees
Labels
No labels