Hello,
I am interested in this library especially for its support of asynchronous signals.
However, I am a bit disappointed because the following basic scenario only works for the synchronous case (or maybe I am missing something ?):
import { reactive, signal, watcher } from "signalium";
const pause = (delay: number) => new Promise((resolve) => setTimeout(resolve, delay));
const name = signal("world");
const hello = reactive(() => `hello ${name.value}`);
// const hello = reactive(async () => `hello ${name.value}`);
const w = watcher(hello);
w.addListener(async () => {
console.log("Value: ", await w.value);
});
// correctly logs: "Value: hello world"
await pause(1000);
console.log("Changing value");
name.value = "developers";
// logs (in the synchronous case): "Value: hello developers"
// does nothing (in the asynchronous case)
await pause(1000);
This exact code (with the synchronous version) works as expected.
However, if I uncomment the asynchronous version of hello, I don't see the updated version "Value: hello developers".
I have configured the transform (cf my reproduction repository here).
Is there a bug in signalium ? Or how can I make this scenario work ?
Thank you in advance for your answer!
Hello,
I am interested in this library especially for its support of asynchronous signals.
However, I am a bit disappointed because the following basic scenario only works for the synchronous case (or maybe I am missing something ?):
This exact code (with the synchronous version) works as expected.
However, if I uncomment the asynchronous version of
hello, I don't see the updated version "Value: hello developers".I have configured the transform (cf my reproduction repository here).
Is there a bug in signalium ? Or how can I make this scenario work ?
Thank you in advance for your answer!