This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-01
Channels
- # aws (2)
- # aws-lambda (18)
- # beginners (68)
- # boot (6)
- # cider (2)
- # clara (2)
- # clojars (27)
- # clojure (68)
- # clojure-austin (5)
- # clojure-berlin (6)
- # clojure-dev (28)
- # clojure-greece (7)
- # clojure-italy (46)
- # clojure-japan (3)
- # clojure-nl (1)
- # clojure-russia (8)
- # clojure-sg (1)
- # clojure-spec (17)
- # clojure-uk (86)
- # clojurescript (82)
- # community-development (2)
- # cursive (18)
- # datomic (11)
- # duct (5)
- # fulcro (254)
- # garden (2)
- # graphql (6)
- # hoplon (19)
- # instaparse (4)
- # kekkonen (2)
- # leiningen (4)
- # luminus (3)
- # lumo (9)
- # off-topic (28)
- # om (7)
- # onyx (38)
- # other-languages (27)
- # portkey (7)
- # protorepl (1)
- # re-frame (56)
- # reagent (64)
- # ring (14)
- # ring-swagger (7)
- # shadow-cljs (255)
- # sql (2)
- # vim (11)
- # yada (10)
@joshkh maybe this one https://github.com/Day8/re-frame/blob/master/docs/FAQs/PollADatabaseEvery60.md
@mikethompson that's the one, thanks.
Hi, can I use reagent
's r/track
method in a re-frame
project? I got an error when I try to do this:
you con't seem to have clj-devtools installed ?
I run this code in a wechat
simulator and the simulator blocks the formatter of the devtools.
what is a wechat simulator?
yes! I used wechat when I was in china 🙂 I was wondering what the simulator is. Are you developing a wechat application?
It seems like you can do Everything in we chat
The first message is this re-frame: no handler registered for effect:
But then we don't get to see which effect keyword is unregistered
cljs.core.Keyword {ns: null, name: "target", fqn: "target", hash: 253001721, cljs$lang$protocolmask$partition0$: 2153775105, …} ". Ignoring.
effects are returned by event handlers
Because I want to decompose the component to in another place. I do not want to define the app-state
globally.
(reg-event-fx
:logger-iframe-dispose
(fn [_ _]
(swap! logger-state assoc :exist false)))
The error is from the lines above
you are returning a map with {:exist false} in it from the swap!
so reframe is looking for an effect defined for :exist
as if you'd typed
(reg-event-fx
:logger-iframe-dispose
(fn [_ _]
{:exist false})))
(swap doesn't return nil, it returns the new value)
When I call (rf/dispatch [...])
is the global state the one being modified? Does the swap!
statement make the logger-state
my global-state?
what's happening is this
* you call (rf/dispatch [:logger-iframe-dispose])
* the handler
(reg-event-fx
:logger-iframe-dispose
(fn [_ _]
(swap! logger-state assoc :exist false)))
is run* that handler swaps the local state atom as you'd imagine
* however it is also returning the new logger state from the swap
* {:exist false ...}
* reframe interprets this as you wanting to dispatch the :exist
effect with args false
So I cannot do rf/dispatch
if what I want is just change the local state, leave the global state untouched.
* the :exist
effect hasn't been dispatched
the quickest way to make the error go away would be to do this
(reg-event-fx
:logger-iframe-dispose
(fn [_ _]
(swap! logger-state assoc :exist false)
nil))
but it might be better if you're dealing with local state like this to call functions directly
reframe handlers tend to be pure
but I hope this helps understand why you got the error and what is going on
yeah that is probably clearer
hi, i was just curious to see if anyone has any thoughts regarding posh vs (or even with) re-frame. It’s obviously not as mature as re-frame, but i’m also doing datomic on the server, so the relative consistency between the two is attractive
i saw https://github.com/denistakeda/re-posh a while back... never tried it though
I’m messing around with an interactive form builder, and it’s underlying data structure can get a bit complex. So I was using specter to do that stuff in the event handlers, but in just my few hours of playing around, it seems a bit nicer in terms of being able interact with it as datomic-lite.. at least for my use case
I'm looking to force re-frame to run through its entire queue before I background. In looking through the source, I haven't found such a function. Any tips?
I can see the issue with such a function, since it may never exit, but I don't quite see how I'm supposed to ensure some events are executed before I background without just doing a bunch of serial dispatch-sync
calls outside of an event handler... which isn't very idiomatic re-frame usage.