This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-08
Channels
- # architecture (20)
- # beginners (140)
- # cider (155)
- # cljsjs (1)
- # cljsrn (29)
- # clojure (53)
- # clojure-dev (9)
- # clojure-italy (40)
- # clojure-nl (13)
- # clojure-poland (4)
- # clojure-russia (8)
- # clojure-uk (51)
- # clojurescript (74)
- # cursive (36)
- # data-science (1)
- # datomic (3)
- # emacs (14)
- # fulcro (11)
- # graphql (2)
- # java (21)
- # javascript (2)
- # jobs (3)
- # nrepl (7)
- # off-topic (18)
- # om-next (1)
- # onyx (9)
- # portkey (8)
- # re-frame (72)
- # reagent (64)
- # reitit (4)
- # remote-jobs (1)
- # rum (1)
- # schema (1)
- # shadow-cljs (49)
- # slack-help (1)
- # spacemacs (8)
- # specter (7)
- # tools-deps (27)
- # vim (28)
Here is an initial cut https://github.com/cljsrn/side-fx
I'll work to clean it up (for example, the fetch API is a little heavy handed with clj->js
and it also shouldn't unconditionally assume JSON is being returned.
Cool. I'll check it out.
Yeah, I'd lean towards conservatism with regards to js->clj and back. Particularly associated with request params and json body on posts.
Only other immediate feedback is that re-frame explodes noisely when there's no matching event handler. That's why I use (when on-success (dispatch on-success))
rather than a [::no-op]
default.
Also, your fetch-fx bakes in json decoding. Certainly fits the common case. Perhaps needs a json specific sounding name to match.
All that aside seems useful without being opinionated. +1
Cool. I've copied the http-fx pattern of using :or
to ensure something for on-success
. I'll look into how that is insufficient.
So much cool info/activity on this channel in the last few days. Thanks @olivergeorge & @mfikes 🙂
@mfikes It turns out (.getItem AsyncStorage "invalid") will nil result and no error. I think storage-fx might need to wrap values so it can detect misses.
e.g. (.setItem AsyncStorage (pr-str key) (pr-str {:data data})...)
Possibly just testing for a string result would suffice actually.
Slightly less neat but this is what I had in mind
(defn get-item
[{:keys [key on-success on-failure]}]
(.getItem AsyncStorage (pr-str key)
(fn [error result]
(cond error
(dispatch on-failure {:type :fault :error error})
(nil? result)
(dispatch on-failure {:type :unavailable})
(string? result)
(try (dispatch on-success (read-string result))
(catch :default e
(dispatch on-failure {:type :fault :error e})))))))
With a helper to clean up the code a bit
(defn dispatch [ev & args]
(when ev (re-frame/dispatch (into ev args))))
Note: For kicks I've thrown in error types based on https://github.com/cognitect-labs/anomalies
Answering my own question. cljs-devtools works just fine with Remote JS Debugging.
One caveat is that the :preloads
compiler option doesn't work so you need to add it to your main ns
Cool @olivergeorge I put in your suggestion, namespacing the keys to make it easier to spec later. I left the dispatch stuff alone for now. We can change it later if desired... it is currently following https://github.com/Day8/re-frame-http-fx/blob/master/src/day8/re_frame/http_fx.cljs#L42-L43 which seems to at least let you know you failed to set a handler (or alternatively you can set a default one for that case)
If anyone has some knowledge surrounding re-natal
's Figwheel bridge operation, this is a good one to chew on and perhaps solve: https://github.com/drapanjanas/re-natal/issues/179
Exception in thread "main" java.lang.ExceptionInInitializerError at clojure.main.<clinit>(main.java:20) Caused by: clojure.lang.ExceptionInfo: Error duplicate key spec {:k :figwheel-sidecar.schemas.cljs-options/process-shim}, compiling:(figwheel_sidecar/schemas/cljs_options.clj:592:1)
hi, i'm following the instructions here https://github.com/flexsurfer/re-frisk/wiki/Using-re-frisk-with-re-natal to try to get a re-frisk debugger going with re-natal, and the server starts, but the contents of the 3 panels are just a green "not connected" - is there a step missing, or is there some other action i need to take to get it all linked up? (If there's a better channel to ask, please let me know) Thanks!
If you’re using android simulator, you probably need to open port 4567 adb reverse tcp:4567 tcp:4567
. Also, have you checked network and js errors in devtools console on http://localhost:4567 ?