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?Probably not because it doesn't touch :params
at all.
is there a way to debug the cause?
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.
@p-himik what are sourcemaps?
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.
@p-himik what port would I be able to debug at?
I debug directly in the browser where there's no need to use any ports.
Have you ever debugged JavaScript?
it’s a react native app
the packer is running on :8081. Would it be that one?
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.
where exactly should I put the breakpoint?
In the re-frame event handler? What would that tell me that I can’t find with print statements in my source?
It seems like you have a lot of questions that really belong in #beginners. I cannot teach you how to debug programs.