Fork me on GitHub

I may have missed something but does anybody know of a good way to check whether a handler/fx-handler has been registered, and only dispatch when it has been registered?


AFAIK there’s not an officially documented way to do that


I think the general assumption is that all handlers are registered at startup (or before they are needed)


there is re-frame.registrar/get-handler, which you could use to check the registrar to see if a handler with the ID you’re looking for has been registered. not sure how @mikethompson would feel about users leveraging that tho

👍 4

Hi @lilactown thanks a lot! I'll have a look at the get-handler function. To your point about registering all handlers at startup, I think I'm doing that but I'll have a second look to make sure that, that's actually the case.


@ryuei.sasaki confirming: there's no official API for that, because, as @lilactown said, all handlers are registered on startup. My last statement is a white lie because you can, actually, dynamically add and remove handlers at a later point, which is what re-frame-async-flow does, but that is very unusual.