Closed polymeris closed 5 years ago
Hi,
Yes, you are right - init
is asynchronous because it involves an http call. You can use core.async/<!
on the return value of init
to block until it is ready, and then make your own call to Martian.
e.g.
(go (<! (martian/init "http://swagger.com")
(re-frame/dispatch [::martian/request :some-operation {}]))
Thanks for the quick response. That solution should work.
Calling
martian/init
and immediately dispatching a::martian/request
throws an error in::on-complete
:No protocol method ISet.-disjoin defined for type cljs.core/List
I think it is because
re-frame/dispatch-sync
is called in an asyncgo
block:https://github.com/oliyh/martian/blob/6c1a3e6af971ebe3cd3352ffa44a45b65819a1b8/re-frame/src/martian/re_frame.cljs#L60