This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-11
Channels
- # beginners (79)
- # boot (21)
- # cider (28)
- # cljs-dev (1)
- # clojure (88)
- # clojure-italy (3)
- # clojure-russia (6)
- # clojurescript (49)
- # community-development (4)
- # cursive (37)
- # datomic (12)
- # editors (3)
- # emacs (33)
- # fulcro (15)
- # hoplon (9)
- # jobs-discuss (3)
- # keechma (3)
- # lein-figwheel (2)
- # luminus (3)
- # off-topic (146)
- # onyx (5)
- # portkey (11)
- # re-frame (34)
- # reagent (7)
- # reitit (5)
- # remote-jobs (1)
- # shadow-cljs (6)
- # unrepl (11)
@itruslove thankyou for putting me straight.
Hey guys, I'm having a n00b issue
I am trying to register "handlers" for doing async stuff with re-frame/register-handler
then I dispatch the event as usual #(re-frame.core/dispatch [:load-items])
but I'm getting the error ":load-items is not a registered event"
Do I need to somehow let me app know that I have handlers?
Or dispatch the event differently?
or something else?
I'm not defining an event for it. I'm just using frame/register-handler
Perhaps this: https://github.com/Day8/re-frame/blob/master/docs/Basic-App-Structure.md#theres-a-small-gotcha
The solution in your core.cljs
would like like this:
https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/core.cljs#L7-L8
ah thanks @mikethompson
> re-frame.core/register-handler has been renamed re-frame.core/reg-event-db. There’s now three kinds of event-handlers, -db, -fx and -ctx. Event handlers of the 2nd and 3rd kinds should be registered via the new registration functions re-frame.core/reg-event-fx and re-frame.core/reg-event-ctx
requiring my handlers.cljs file in core.cljs worked! 🙂
0.10.4
I created the project a few days ago with lein re-frame ...
:very_nice:
why no icons?
I like re-frame a lot. It's funny thought bc to me it is way more similar to angular's ngrx than react+redux
Good to hear. Always interesting to hear the perspective of those coming in fresh from other paths.
Hello! New member here. This must be a trivial mistake but I would be really grateful if someone would point it out. I keep getting this error message while querying my GraphQL server:
[: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]
Here is the event handler:
(re-frame/reg-event-fx
::request-it
(fn [{db :db} _]
{:http-xhrio {:method :post
:uri ""
:params {:query "{ court(id: 2) {id}}"}
:format (ajax/json-request-format)
:response-format (ajax/json-response-format {:keywords? true})
:on-success [::process-response]
:on-failure [::bad-response]}
:db (assoc db :loading? true)}))
The same query is working with curl.
Thanks a lot!Sorry, don't see any obvious things wrong. I'm a bit new to GraphQL myself, but use re-graph, but queries and subscriptions working well. https://github.com/oliyh/re-graph/
@milos.mrdakovic1 take a look in your console and network connection in devtools, status 0 means something went wrong and the request wasn’t attempted
if I had to guess I’d say it’s CORS
Weird, I have an event handler registered with re-frame/reg-event-fx
, it’s been working fine until today, I can put console.log statements in to verify that the reg code is running, but now suddenly re-frame is insisting that the handler is not registered.
Are there any known gotchas that I ought to be looking for?
I’m definitely require
-ing the ns
@danielcompton It was CORS. Thanks a lot! @gklijs Thanks for the suggestion. I'll definitely have a look.
Ah, I see, I added an intermediate function to do the actual dispatch, and both it and the caller were adding the square brackets, so I was getting [[:my-weird-event]]
instead of [:my-weird-event]
, and the error message was saying No handler for [:my-weird-event]
. The square brackets should have given it away, but I’m used to seeing square brackets around events in re-frame, so I didn’t notice.