Fork me on GitHub

you should totally link to these lines from your new FAQ entry 🙂


There's also dispatch-later effects, etc


Hi, who have already tried kee-frame . Any reviews?


I’m experimenting with it, very clean, etc. Trying to figure out an issue when their not being a route when the page loads


Hi everyone! Does anyone have an example or can give a hint on how to subscribe to a route change?


Thanks! I'm sorry I didn't explain properly what I need. Here's a better explanation of the issue I'm having


The error response I get with http-fx doesn’t seem to give a status code in the way I’d expect:

{:uri "",
 :last-method "POST",
 :last-error " [0]",
 :last-error-code 6,
 :debug-message "Http response at 400 or 500 level",
 :status 0, 
 :status-text "Request failed.", 
 :failure :failed}
Is there a way to get a :status 500 or somesuch?


@alex-dixon I think the :status comes directly from the response map returned from the xhr response


So to me, that looks like your response map itself (from whatever server you are getting it from) is returning a :status 0


Ok. Server was down…was expecting a 404?


The error handler is firing when I receive this, which seems triggered by an empty response body from the server. If I put {ok: true} it registers as success:

[:response nil]
[:last-method "POST"]
[:original-text ""]
[:last-error ""]
[:failure :parse]
"Unexpected end of JS … been JSON keywordize"
Unexpected end of JSON input  Format should have been JSON keywordize
[:status 200]
[:uri ""]
[:debug-message "No Error"]
[:last-error-code 0]


I’m using (json-response-format {:keywords? true}) for :response-format


@alex-dixon I’m wondering at this point if your issue is not in re-frame’s :http-xhrio fx, but instead in the ajax lib response formatting


I don’t know how a :response nil is translating to a :status 0 for you


Not sure what you posted above.


Looks like a :status 200 in that


Yeah. I have a Node/Express server doing res.status(200).send() which seems to result in a parse error


If I provide some dummy body on the server like res.status(200).send({ok: true}) there’s no parse error and it registers as successful with re-frame


The request itself is processed via ajax.core/ajax-request. re-frame :http-xhrio doesn’t determine if it is an error or success it looks like


it just gives a success and error handler to that underlying lib


I don’t know enough at that level to have much good advice as to why your response is coming back like htat


Perhaps try debugging a bit at that level


Thanks. It’s workable but seems like it could be a bug. At least would like it to be smoother for beginners. I started writing a comparison of re-frame and Redux for JS devs over the weekend and :http-xhrio is a great feature that I mention quite a bit

👍 4

could be that http was 200 but the library threw its own error trying to understand the response: “Unexpected end of JS … been JSON keywordize”

👍 4

Is it possible to write handlers that do something like this?:

  [::success ::routes/dashboard]
  (fn [{:keys [db]} x]
    (println "GQL success" x)))


I can do something like this but not sure if it’s better:

  (fn [{:keys [db]} [_ route-key result]]
    (let [handler (route-key query->success-handler)]
      (when handler (handler result)))
    (println "GQL success" x)))


Pretty sure it’s not 😅


@alex-dixon I end up doing things like :dashboard/success


if you want to use the “real ns”, then like ::dashboard-success


it seems to me that you aren’t buying anything by putting a lookup map in the query->success-handler


might as well just lay out each “handler” as an event for its purpose. I don’t see dynamism in what you have above that would have any advantage to having a parameterized route-key in the event vector input


Unless you are wanting to have a fallback/default for unhandled things


I haven’t seen many examples of using non-keyword keys for registered events/subs in re-frame. I don’t know if anyone has pointed out to pro’s/con’s to doing that though.


Thanks. Hadn’t considered. There’s tradeoffs to each I suppose. Guess I was wondering if there’s something like rf/path or some middleware I could/should be using more. Most of the examples I’m seeing are as you describe


is re-com a dead project?


@matthewdaniel we're making solid use re-com so it certainly isn't dead to us


UIs libraries are difficult to generalise (in styling terms)


@robert-stuttaford @soulflyer can you give ways to reproduce the errors you're seeing? I took a look at Bridge, but couldn't figure out how to get the errors you were seeing, Figwheel just 404'd on the JS


I also took a look at hinh-anh and also couldn't get the errors to show up


@mikethompson it looks like pull requests are being ignored, i am more wondering dead as in not being maintained rather than unused


Hi, I'm looking for examples of routing where more "general" routes are hit before more specific routes. For example, if there were two routes for /admin/users and /admin/posts, the routing lib would detect that I'm attempting to enter the /admin route regardless of the sub-route, and check that my authenticated account has access. This may already be supported (currently trying to get familiar with bidi), but I haven't seen an example of it yet. Any help/pointers/links would be grealy appreciated.


I’m experimenting with it, very clean, etc. Trying to figure out an issue when their not being a route when the page loads