In some scenarios computeds can get stuck in an infinite loop and/or cause out of memory.
Here is a minimal program that will get stuck:
import { computed, signal } from "alien-signals";
const fieldA = signal(false);
const fieldB = signal(false);
const a = computed(() => {
return b() !== true ? fieldA() : null;
});
const b = computed((): boolean | null => {
return a() !== true ? fieldB() : null;
});
console.log("a", a()); // false
console.log("b", b()); // false
fieldA(true);
console.log("Field A changed");
// BREAKS HERE when trying to get a
console.log("a", a());
console.log("b", b());
What I would expect:
At least that it would not get stuck in an infinite loop.
But I am not sure about the result.
I am not sure if this should be part of the core of alien-signals as the result may be a bit ambigous.
In some scenarios
computeds can get stuck in an infinite loop and/or cause out of memory.Here is a minimal program that will get stuck:
What I would expect:
At least that it would not get stuck in an infinite loop.
But I am not sure about the result.
I am not sure if this should be part of the core of alien-signals as the result may be a bit ambigous.