This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-01
Channels
- # 100-days-of-code (2)
- # announcements (3)
- # beginners (95)
- # bitcoin (1)
- # cider (18)
- # cljdoc (9)
- # cljs-dev (8)
- # clojure (55)
- # clojure-austin (1)
- # clojure-berlin (4)
- # clojure-italy (21)
- # clojure-nl (1)
- # clojure-russia (2)
- # clojure-spec (47)
- # clojure-uk (31)
- # clojurescript (19)
- # component (8)
- # cursive (5)
- # data-science (2)
- # datomic (33)
- # emacs (7)
- # events (1)
- # figwheel (8)
- # fulcro (16)
- # graphql (27)
- # hyperfiddle (5)
- # jobs (1)
- # jobs-discuss (85)
- # keechma (7)
- # luminus (11)
- # mount (6)
- # off-topic (23)
- # onyx (1)
- # re-frame (4)
- # shadow-cljs (29)
- # specter (19)
- # tools-deps (11)
- # uncomplicate (3)
Hi. Back in 2016, in ClojureScript 1.9.293, some changes were made to prevent problems with checking protocol membership when using :advanced builds (See https://groups.google.com/forum/#!topic/clojure/onmJ2uyQzC4 ). I'm not sure if these changes were expected to be a complete fix for the problems discussed in the mentioned thread, but I am experiencing them now with js->clj using cljs 1.10.339. There are some more details on an issue I filed against cljs-ajax: https://github.com/JulianBirch/cljs-ajax/issues/219 . Is this expected behavior, and I am supposed to avoid js->clj for external json data, or did just I stumble on to a cljs bug?
@schmandle the issue was fixed for normal protocols yes but not "fastpath" protocols like ISeq
so you can run still into it if the JSON data contains a field with a number that "accidentally" has the bits set of some protocol. eg. {"ab":4}
when cljs$lang$protocol_mask$partition..
was renamed to ab
A question: is it possible to upload files (FormData) via re-frame-http-fx? I know it wraps around cljs-ajax, but it seems to be using only the simpler "ajax-request" API, and that API doesn't seem to specify necessary keys.
{:http-xhrio {:method :post
:uri (api/api "path/to/upload-endpoint")
:body formdata-with-file
;;:format (ajax/transit-request-format)
;;:response-format (ajax/transit-response-format)
:response-format (ajax/raw-response-format)
:on-success [::success-handler]
:on-failure [::fail-handler]}}
This is how my invocation looks like; what I get in response is "unrecognized request format: nil".what I'm trying to achieve is essentially cljs-ajax's
(POST "/send-file" {:body form-data
:response-format (raw-response-format)})
but written as re-frame-http-fxok, RE my question about file upload - turns out it's a case of PEBKAC, and I didn't notice my file data was actually nil
(due a parameter being eaten somewhere upstack), so nevermind 🙂
Hey guys! I'm using reagent, and have the following code calling a component, but instead of returning an object, I'd like to return a string, how would I go about this?
It's returning an object right now
@im defroute is a macro that apparently always returns a function https://github.com/gf3/secretary/blob/master/src/secretary/core.clj#L3
@souenzzo ah so I can’t. Alright, I’ll figure another way out of this 😁. Thank you!
Will do! 🙂
How would I go about calling a function like (defn content-dispatch [name] (content-{name}))
?
I would probably do something like
(def dispatch-map
{"foo" content-foo
"bar" content-bar
...}
(defn content-dispatch [name]
(let [dispatch (get dispatch-map name)]
(dispatch)))
Though it probably wouldn’t come up that often since you can pass around functions as easily as you can pass around strings.