Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[re-frame] Error when performing request immediately after init #57

Closed
polymeris opened this issue Aug 31, 2018 · 2 comments
Closed

[re-frame] Error when performing request immediately after init #57

polymeris opened this issue Aug 31, 2018 · 2 comments

Comments

@polymeris
Copy link
Contributor

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 async go block:

(go (let [martian (<! (martian-http/bootstrap-swagger swagger-url params))]

@oliyh
Copy link
Owner

oliyh commented Aug 31, 2018

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 {}]))

@polymeris
Copy link
Contributor Author

Thanks for the quick response. That solution should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants