Skip to content

How to create store events and handlers external to the store #91

Answered by zuriscript
st-clair-clarke asked this question in Q&A
Discussion options

You must be logged in to vote

Registering an Event and a handler outside the stores is well-supported and should generally not introduce any circular reference error.
Check out the following stackblitz: https://stackblitz.com/edit/signalstory-discussion-91?file=src%2Fmain.ts

What could introduce a circular reference, are reflexive or transitively looping event handler relations:
You publish EventA and EventAHandler1 publishes EventB whereas EventBHandler1 again publishes EventA => Infinite Loop.
This can get quite complicated to track if you have a large chain of events, for example, if EventA leads to EventB, leads to EventC, leads to EventD , and so on, which finally leads back again to EventA being published.

If it…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@st-clair-clarke
Comment options

Answer selected by zuriscript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants