Fork me on GitHub
#re-frame
<
2021-03-22
>
zendevil.eth22:03:05

I’m sending a post request with qualified keywords like so:

:http-xhrio {:method :post
   :uri "/the-uri"
   :params {:user/foo 1 :user/bar 1}
   :on-success [:foo]
   :on-failure [:bar]
   :response-format (edn/edn-response-format)
   :format (edn/edn-request-format)
   }
And also using cljs-ajax library purely:
(ajax-request {:uri "/the-uri" :method :post :params {:user/foo 2 :user/bar 2} :handler (fn [res] (prn res)) :format (edn/edn-request-format) :response-format (edn/edn-response-format)})
In the former case, the incoming :params in the server aren’t namespace qualified, i.e., {:foo 1 :bar 2}, whereas in the latter case they are, i.e., {:user/foo 1 :user/bar 2}. Is this a bug in the re-frame-http-fx library?

p-himik22:03:51

Probably not because it doesn't touch :params at all.

zendevil.eth23:03:25

is there a way to debug the cause?

p-himik23:03:20

Sure, same way you debug JavaScript. If you have sourcemaps set up correctly (which should be by default with at least shadow-cljs) and, perhaps, if you're using cljs-devtools, then you just open the relevant file in Chrome's devtools and set a breakpoint and go from there.

zendevil.eth23:03:01

@U2FRKM4TW what are sourcemaps?

p-himik23:03:53

Any web search engine would give you a description that's better than anything I could come up with. It's a fundamental part of frontend development.

zendevil.eth23:03:23

@U2FRKM4TW what port would I be able to debug at?

p-himik23:03:02

I debug directly in the browser where there's no need to use any ports.

p-himik23:03:11

Have you ever debugged JavaScript?

zendevil.eth23:03:22

it’s a react native app

zendevil.eth23:03:46

the packer is running on :8081. Would it be that one?

p-himik23:03:07

Ah, then I have zero clue. I'd search for how to debug React Native apps written in JavaScript. Then I'd transition that knowledge to ClojureScript.

zendevil.eth23:03:04

where exactly should I put the breakpoint?

zendevil.eth23:03:24

In the re-frame event handler? What would that tell me that I can’t find with print statements in my source?

p-himik23:03:21

It seems like you have a lot of questions that really belong in #beginners. I cannot teach you how to debug programs.

👍 3