This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-03
Channels
- # beginners (446)
- # boot (16)
- # cljs-dev (2)
- # cljsrn (30)
- # clojars (2)
- # clojure (143)
- # clojure-finland (1)
- # clojure-greece (1)
- # clojure-nl (1)
- # clojure-russia (2)
- # clojure-spec (20)
- # clojure-uk (7)
- # clojurescript (167)
- # code-reviews (1)
- # community-development (12)
- # core-async (27)
- # cursive (3)
- # data-science (9)
- # datascript (2)
- # emacs (1)
- # graphql (46)
- # immutant (5)
- # jobs (2)
- # leiningen (1)
- # luminus (1)
- # lumo (76)
- # off-topic (79)
- # perun (2)
- # protorepl (33)
- # re-frame (21)
- # reagent (62)
- # ring-swagger (1)
- # rum (18)
- # spacemacs (6)
- # specter (4)
- # test-check (4)
- # unrepl (9)
- # untangled (2)
- # vim (4)
- # yada (1)
hey, i'm working on my first cljs rn project right now and i'm trying to figure out a decent way to make API calls to our server. i've got an ugly partial-solution using js/fetch, but it looks like (as my friend says) "Javascript with parens", and i'm getting into trouble when having to make multiple API calls to fill one resource. anybody got any good direction for me to look?
Hi! I'm the friend! The concern I was voicing was that resetting state atoms inside of nested .then
calls (on a js/fetch
promise) set off my "there must be a better way" sense (either a way to bring the process closer to clojure semantics or a way to bubble updating app state up to a higher call site). I could be totally wrong—cljs is not a particular area of my expertise.
i believe there is something out there that makes promises and core.async channels play nicely w/ each other
Which part do u think u want: something that runs in cljs and does network requests nicely, or something that wraps promises nicely and u continue using fetch?
if u think u have many js promisy apis u wanna use directly the latter may make more sense, if this is basically the only one the former could
the component thing is to allow cljs to jack in a root component async'ly after it runs
in the case of making a huge js compiled single bundle of ur app (like for 'prod') this is all irrelevant
The boot-expo thing i released recently basically does figwheel-bridge in way fewer lines in main.js https://github.com/nikki93/boot-expo/blob/master/main.js
figwheel-bridge does some weird wait loop stuff to eval the received js in the right order; my version just does a "right fold" through time of promises ;)
nikki: have you by any chance posted this in a blog or similar? I would like to add some docs to re-natal. The more information I have the better 😀
o it's this project @carocad -- https://github.com/nikki93/boot-expo
@nikki thanks! so i'm not dedicated to using js/fetch
or anything, i just figured it'd be the best way to try to get it to work, as it seems like it's being encouraged as the way to go for http requests in javascript ("future-proof" i think i read somewhere).
that being said, i'm doubting i'm going to be using any additional promises other than http requests. so i'm not sure which approach would be best.
oh, and i'm developing primarily for Android (at first) and i had read here: https://github.com/JulianBirch/cljs-ajax/issues/141 that calling XmlHttpRequest was giving people headaches, so that's why i was leaning more towards fetch. but again, no loyalty, just trying to make things easy on myself
@iwsfutcmd The only thing we had to do to get Promesa to work was add an empty org.bluebird
namespace to prevent Promesa from loading the real Bluebird library.
pardon the lack of specificity, but using re-natal what could be causing figwheel repl not to connect, and saving files not to hot-reload the application?
https://facebook.github.io/react-native/docs/debugging.html#accessing-the-in-app-developer-menu
but also make sure it's got the right way to connect to ur computer as a server, be that a LAN ip/hostname or ngrok tunnel or whatever
@iwsfutcmd The only thing we had to do to get Promesa to work was add an empty org.bluebird
namespace to prevent Promesa from loading the real Bluebird library.