Hi,
I’m building a toast notification component that uses an id to uniquely identify each toast so it can remove itself from an array after a timer expires.
Initially, I kept all the logic inside the component, including ID creation and the removal timer, but this led to bugs, especially with multiple toasts. In one version, each toast managed its own timer and deletion, but that also caused unpredictable behavior.
The issue: when multiple toasts are triggered at once, sometimes the wrong toast gets removed, or none at all. I confirmed something was wrong because undefined was being returned, even though the ID was set earlier in the flow.
After reading that global workflows are the only truly async workflows, I moved toast creation into a global workflow. The component still generates the ID and uses “Return a value,” but the global workflow doesn’t seem to receive it.
How can I properly return a value from a component and access it in a global workflow?
or..
Are component workflows actually async and I have a broader issue?