Fork me on GitHub

Here is an initial cut 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.

Oliver George00:05:15

Cool. I'll check it out.

Oliver George00:05:36

Yeah, I'd lean towards conservatism with regards to js->clj and back. Particularly associated with request params and json body on posts.

Oliver George00:05:54

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.

Oliver George00:05:08

Also, your fetch-fx bakes in json decoding. Certainly fits the common case. Perhaps needs a json specific sounding name to match.

Oliver George00:05:40

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.


And, yeah, it shouldn't unconditionally assume JSON


So much cool info/activity on this channel in the last few days. Thanks @olivergeorge & @mfikes 🙂

👍 4
💯 4
Oliver George09:05:54

@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.

Oliver George09:05:25

e.g. (.setItem AsyncStorage (pr-str key) (pr-str {:data data})...)

Oliver George10:05:10

Possibly just testing for a string result would suffice actually.

Oliver George10:05:48

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

Oliver George10:05:26

With a helper to clean up the code a bit

(defn dispatch [ev & args]
  (when ev (re-frame/dispatch (into ev args))))

Oliver George10:05:04

Note: For kicks I've thrown in error types based on

Oliver George10:05:39

Answering my own question. cljs-devtools works just fine with Remote JS Debugging.

Oliver George11:05:30

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 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)

👍 4

I've started capturing issues in that repo


If anyone has some knowledge surrounding re-natal's Figwheel bridge operation, this is a good one to chew on and perhaps solve:


I am getting following error with expo react native -


Exception in thread "main" java.lang.ExceptionInInitializerError at clojure.main.<clinit>( 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)


i have install the npms with 'yarn install'


singing up exp


lein figwheel blows up


with this error


hi, i'm following the instructions here 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 ?


yeah - it looks like there's a ping error every once in a while in the network panel, which is probably the actual problem, but the page is loading fine, and the websocket looks connected fine. All ports are open correctly, afaict.