[ClojureScript] Reagent/re-frame drag event weirdness

2015-07-22 Thread David Pidcock
I'm playing with Reagent + re-frame (and re-com) for a toy project of mine and I noticed something strange. I'm creating a component I want to use to drag things around with: (defn drag-handle [] (fn [] [re-com/label :style {:padding "5px"} :label "||" :attr {:id (:id combata

Re: [ClojureScript] Reagent/re-frame drag event weirdness

2015-07-22 Thread Colin Yates
Events use the flyweight pattern and are effectively nil after the callback. Dispatch is async so you need to extract what you need from the event in the callback and pass that into the dispatch. On 22 Jul 2015 21:10, "David Pidcock" wrote: > I'm playing with Reagent + re-frame (and re-com) for

Re: [ClojureScript] Reagent/re-frame drag event weirdness

2015-07-22 Thread David Pidcock
Thank you. So expected behaviour :D Quick clarifying question : when you say "Events use the flyweight pattern" do you mean Javascript events themselves, or the Clojurescript event objects that wrap them? -- Note that posts from new members are moderated - please be patient with your fi

Re: [ClojureScript] Reagent/re-frame drag event weirdness

2015-07-22 Thread Colin Yates
Actually I can't find the reference (somewhere in the om wiki?), so I don't know why, but I do know the event is only usable in the callback. Might be leading you up the garden path wrt the flyweight pattern :). On 22 Jul 2015 21:31, "David Pidcock" wrote: > Thank you. > So expected behaviour :D

Re: [ClojureScript] Reagent/re-frame drag event weirdness

2015-07-22 Thread David Pidcock
On Wednesday, July 22, 2015 at 1:31:16 PM UTC-7, David Pidcock wrote: > Thank you. > So expected behaviour :D > > Quick clarifying question : when you say "Events use the flyweight pattern" > do you mean Javascript events themselves, or the Clojurescript event objects > that wrap them? NVM =

Re: [ClojureScript] Reagent/re-frame drag event weirdness

2015-07-22 Thread Daniel Kersten
React refuses the "synthetic" event objects AFAIK. On Wed, 22 Jul 2015 21:39 David Pidcock wrote: > On Wednesday, July 22, 2015 at 1:31:16 PM UTC-7, David Pidcock wrote: > > Thank you. > > So expected behaviour :D > > > > Quick clarifying question : when you say "Events use the flyweight > patte