re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
zackteo 2021-06-12T09:12:01.103500Z

May I ask what is a simple way for me to view the contents of my :db ?

p-himik 2021-06-12T09:14:20.103800Z

re-frame-10x or re-frisk

zackteo 2021-06-12T09:15:31.104Z

How do I access the value actually? Or must it be through a subscription?

p-himik 2021-06-12T09:17:25.104200Z

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.

zackteo 2021-06-12T09:33:18.104400Z

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

p-himik 2021-06-12T09:36:19.104600Z

Just follow the guide in the README.

zackteo 2021-06-12T09:37:34.104800Z

Whoops yeah was confused for a moment, but found the explanation on that after including re-frame-10x on its own!

p-himik 2021-06-12T09:37:53.105Z

Also, debux readme mentions: > still a work in progress and there'll likely be little annoyances and bugs, perhaps even big ones

2021-06-12T21:39:11.107100Z

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             "<https://stuartstein777.github.io/fitness/daily.json>"
                 :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?

p-himik 2021-06-12T21:41:59.107500Z

Both of your formats use json-request-format function. One of them should be a response format, IIRC.

2021-06-12T21:42:53.107700Z

aaaaaaaaaaaaargh! you are correct, i never noticed that

2021-06-12T21:42:56.107900Z

thank you.

2021-06-12T21:43:19.108100Z

I've been looking at that code for 30 mins now, trying to see whats wrong. You spot it immediately sigh

p-himik 2021-06-12T21:56:26.108300Z

Well, the error does hint at it with its "Format should have been". :)