track signal dependencies

This commit is contained in:
Yura Dupyn 2026-02-16 20:35:24 +01:00
parent c0198d419f
commit b9332ad565
2 changed files with 32 additions and 16 deletions

View file

@ -51,13 +51,11 @@ export function SignalDigith(props: { signal: Digith.Signal }) {
// TODO: Not sure about this one. Setting a signal in `setValue` is discouraged.
setTimeout(() => setValue(signal.read()), 0);
// TODO: Handle cancelation...
signal.subscribe((newValue) => {
const cancel = signal.subscribe((newValue) => {
setValue(newValue);
});
onCleanup(() => {
// TODO:
});
onCleanup(cancel);
} catch (e) {
// TODO: setErrors... but how? Shouldn't this be independent of `errors`?
console.log("Failed to link Signal: ", e);