Looks like my problem was solved by changing the parameters I pass to apply-controllers. I used the ::navigated event from the frontend-re-frame example
(re-frame/reg-event-db ::navigated
(fn [db [_ new-match]]
(let [old-match (:current-route db)
controllers (rfc/apply-controllers (:controllers old-match) new-match)] (assoc db :current-route (assoc new-match :controllers controllers)))))
I fixed it by passing (:controllers (:data old-match))
instead of (:controllers old-match)
I think it's a mistake in the example.Hi there. Is it normal to have form-params
as a map of strings to strings? If so, is there a nice way to convert the keys to keywords instead?
There’s middleware for that-- muuntaja.middleware/wrap-format
I think?
or maybe wrap-params
… It’s been a while since I’ve looked at the code.
So I'm using these 3:
;; content-negotiation
muuntaja/format-negotiate-middleware
;; encoding response body
muuntaja/format-response-middleware
;; decoding request body
muuntaja/format-request-middleware
but by the time it hits the handler the params
is still a map of strings to stringsI'll give wrap-format
a try. Thanks 🙂
we’ve got a function that looks like this:
(defn wrap-formats
[handler]
(-> handler
(wrap-params)
(wrap-format muuntaja-opts)))
It’s fairly high/early in our root middleware stack.
no luck so far
at this point I'm pretty sure I've misconfigured something somewhere
in the end I decided to use :parameters -> :form
instead. Never got form-params
to be properly converted without having to write a custom middleware for it.