This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-16
Channels
- # aws (17)
- # babashka (2)
- # beginners (131)
- # bristol-clojurians (1)
- # calva (16)
- # chlorine-clover (6)
- # cider (10)
- # clara (5)
- # cljsrn (82)
- # clojure (176)
- # clojure-dev (14)
- # clojure-europe (13)
- # clojure-italy (13)
- # clojure-nl (4)
- # clojure-spec (10)
- # clojure-sweden (32)
- # clojure-uk (32)
- # clojuredesign-podcast (2)
- # clojurescript (34)
- # community-development (2)
- # conjure (17)
- # cursive (4)
- # datomic (51)
- # emacs (6)
- # figwheel-main (26)
- # fulcro (16)
- # graalvm (11)
- # jobs (2)
- # jobs-discuss (30)
- # kaocha (4)
- # meander (23)
- # off-topic (34)
- # pathom (5)
- # re-frame (10)
- # reagent (3)
- # reitit (6)
- # releases (3)
- # sci (36)
- # shadow-cljs (27)
- # sql (9)
- # testing (6)
- # tools-deps (28)
- # vim (8)
What would be the best way of integrating a library written in Clojurescript with a typescript codebase (+ whatever comes with it, webpack, npm deps and the whole garbage pile)? Looks like shadow-cljs has a node-module target, but it's not 100% clear if that's what I'm looking for
https://shadow-cljs.github.io/docs/UsersGuide.html#_creating_code_npm_code_packages
Is anybody here using GraphQL? If so, what client are you using, and how’s it working out for you?
Interesting. Any advice for if I were to try to go down that path?
just to wrap it in something nice - if you’re using React Hooks, it’s really simple to use react-apollo
. last time we were using Reagent so we wrapped apollo-client
in a reagent reaction which worked out pretty well
alright, I’ll look into that, thanks
I’m using Reagent/Re-frame but I’ve never tried making custom reactions
What would be a good way of getting the results (header + code + body) from js/fetch
into a map? I've not found any libraries that uses the fetch api, only XHR.. I'm trying
(let [obj (-> (js/fetch "")
(.then (fn [x] x))
(.catch "something went wrong..."))
code (.-status obj)]
{:obj obj
:code code})
;=> {:obj #object[Promise [object Promise]], :code nil}
but the code should be 200
, not nil
. this works when I test the http api from the console, and the packets are identical when I look at them from the browser devtools. I'm kind of stuck, so I would appreciate any helpthat Promise is a handle to something that might eventually complete, I wouldn't expect it to have the response code from the server yet because it might not even have made the call when you capture the value you do
I think you need to list the rest of your code into the .then
of the promise, or use a library like core.async that lets you do the equivalent without it turning into a messy series of callbacks
the function inside .then
knows about the status code etc. the code outside it can't
that method returns another Promise iirc, that you can chain another thing onto, etc.
it's a limitation that the js runtime imposes, the problem is that there's only one thread, and if code sat and waited for http responses everything on the page would be very very slow
this mechanism is awkward but allows better performance (since you can't use more threads)
@U017H3L9EHF Look if you don't wanna use that lib this is what you're supposed to do:
(let [obj (-> (js/fetch "")
(.then (fn [x]
(prn (.-status x))
;; needed to get the body out
(.text x)))
(.then (fn [body]
;; your logic must go in this callback, as you are
;; certain that the body as been all streamed down.
(prn body))))])
Hi, I have some problems with variadic args in multimethod. Trying to apply it to the list longer than 20 elements throws wrong arity exception https://gist.github.com/DeLaGuardo/548b6d0eee2c2d29e308d7ffc2c9d43c
Looks like a compile bug for me because in clojure it works
probably an old one? it might actually be a dupe - but I would open issue with those multimethod details
can look later if it's a dupe and then copy over the multimethod case as something to test for when it gets fixed
it's better to have code that's parameterized by the test
what's the use case? if you're thinking about having code behave different during a test, then that's probably not a good idea
@noisesmith @smith.adriane I want to turn off spec instrumentation when the tests are running
I think the cleaner option is not turning on instrumentation from normal code - there should be a top layer that conditionally invokes it