This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-12
Channels
- # announcements (9)
- # babashka (2)
- # beginners (27)
- # clojure (19)
- # clojure-bay-area (1)
- # clojure-germany (7)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojurescript (6)
- # conjure (1)
- # datomic (10)
- # fulcro (11)
- # graalvm (1)
- # introduce-yourself (3)
- # jobs (1)
- # luminus (1)
- # malli (9)
- # off-topic (23)
- # podcasts-discuss (3)
- # polylith (6)
- # practicalli (1)
- # re-frame (14)
- # sci (2)
- # shadow-cljs (5)
With those tools - they do it for you.
On your own - a public API would be to use a sub or an event handler. A private API would be @re-frame.db/app-db
.
Okay! Btw do you happen to know if I need to include [re-frame/tracing] for re-frame 10x? Seems like it has been replaced by re-frame-debux
Whoops yeah was confused for a moment, but found the explanation on that after including re-frame-10x on its own!
Also, debux
readme mentions:
> still a work in progress and there'll likely be little annoyances and bugs, perhaps even big ones
I'm going through the re-frame docs for getting data from servers using day8.re-frame.http-fx
. I have my reg-event-fx
like below:
(rf/reg-event-fx
:get-stuff
(fn [{:keys [db]} _]
{:http-xhrio {:method :get
:uri ""
:format (ajax/json-request-format)
:response-format (ajax/json-request-format {:keywords? true})
:on-success [:process]
:on-failure [:fail]}
:db db}))
My success handler:
(rf/reg-event-db
:process
(fn [db [_ data]]
(js/console.log "here: " data)
(assoc db :bar (:status-text data))))
My fail handler:
(rf/reg-event-db
:fail
(fn [db [_ bad]]
(js/console.log "fail :(" bad)
(assoc db :bar (:status-text bad))))
It ALWAYS goes into fail handler with the error:
Cannot read property 'cljs$core$IFn$_invoke$arity$1' of null Format should have been
I have no idea what that error is meant to be telling me:
Here's what it looks like in the browser console:
It's fetching the json OK. Anyone any idea what the error means?Both of your formats use json-request-format
function. One of them should be a response format, IIRC.