Fork me on GitHub
#om
<
2016-04-12
>
seanirby02:04:54

iwankaramazow: yeah, it seems to be just the linux build of firefox. ran fine on my mac, though I didn't try safari yet.

jimmy09:04:51

hi guys, would update-state! in willmount trigger componentWillUpdate ?

pellegrino12:04:10

hey folks, using go channels for communication between components is still the way to go?

denik13:04:40

@pellegrino: not in om.next. There you use transactions (`om/transact!`) and let the components synchronize through re-rendering with the updated state.

jannis13:04:25

And callbacks, passed down the component hierarchy via props/computed props.

pellegrino14:04:02

thanks for the tip! would it make sense for a clojurescript/om newbie to jump straight to om.next then?

manutter5115:04:09

that’s what I’m doing, but I got to a certain point where the queries were confusing me, so I’m doing the Learn Datalog tutorial to make sure I understand them better. (http://www.learndatalogtoday.org/)

manutter5115:04:57

I’m also coming from having a bit more work with reagent, which is helping — it helped me unlearn jQuery-style design

denik15:04:25

@pellegrino: Definitely over learning om.now. Having the app-state represented as a graph is hard to grok initially. I suggest you get very comfortable w/ ClojureScript first and read how datomic pull queries work. Then look into https://github.com/awkay/om-tutorial

spiralganglion16:04:06

That tutorial (https://github.com/awkay/om-tutorial) hasn't been updated since Feb. Has om.next changed much in that time? I was under the impression that om.next was still in early development.

dnolen16:04:16

@ivanreese: for some flexible definition of “early” development

dnolen16:04:40

after merging in @anmonteiro PR for query updates & wrapping up error handling it will probably go beta

dnolen16:04:31

it’s been under development for over a year now

dnolen16:04:44

things have slowed down because there’s less “big” things to do

dnolen16:04:49

lots of niggling details

spiralganglion16:04:03

Cool to know a beta is impending. Since I have your attention — I'm going to start learning om.next this morning. Is the wiki the best place to start?

dnolen16:04:19

@ivanreese: and asking questions here

spiralganglion16:04:34

I most certainly will be.

dnolen16:04:35

the learning curve is pretty steep due to gaps in the docs

dnolen16:04:56

and probably will be for some time while the shirt gets ironed

spiralganglion16:04:49

Thanks for the warning.

hlolli16:04:55

Short question. I noticed that when using js/interval on transact! for changing slides in a slideshow caused my cpu usage to skyrocket. So I'm trying now to see if using local update-state and get-state for changing slides. But what happens now is that the interval time of 4secs is seemingly ignored and I get a slideshow so fast that it envokes epilepsy attack simple_smile so clearly something is wrong. Maybe I post a snippet...

hlolli16:04:13

(defui Image-slider
  Object
  (componentWillMount [this]
    (js/setInterval #(om/set-state! this {:index (mod (inc (om/get-state this :index)) (count (:slides @app-state)))})) 40000)
  (render [this]
    (let [{:keys [last-index index slides]} (om/props this)]
      (create standard #js {:defaultStyle #js {:x (:width (slides last-index)) :y (:height (slides last-index))}
                            :style #js {:x (spring (:width (slides index)) #js {:stiffness 20 :damping 20})
                                        :y (spring (:height (slides index)) #js {:stiffness 20 :damping 20})}}
              (fn [i]
                (dom/div nil
                                                 (dom/img #js {:id "image-container" :className "img-main img-responsive"
                                       :src (:photo (slides (:index (om/get-state this)))) ;;(:photo (slides index))
                                       :width (.-x i)
                                       :height (.-y i)})))))))

kendall.buchanan16:04:56

@hlolli, is 40000 your interval? Cause it’s sitting outside the js/setInterval function call (it’s being returned for componentWillMount.

hlolli16:04:38

yes oops, that was just an attept to slow it down. HAHA yes, wow, you are right!

hlolli16:04:09

bingo, haha lol, forget I asked this question.

hlolli16:04:17

I wonder why it didn't throw an error.

kendall.buchanan16:04:34

If js/Interval is causing your CPU to spike, it’s probably cause it was running constantly, with no interval at all.

hlolli16:04:51

yes @kendall.buchanan you were right. This is fixed now, cpu at 4%, not 60% like before (with transact, but then setInterval was correctly set up).

hlolli16:04:30

Actually, so to give a full report of this, animating jpg images is just cpu heavy (at least with react-motion), irrelevant of transact! or update-state!

hlolli19:04:48

http://golfhitalausnir.is/ the most intensive cpu slideshow on the internet 😜 ? (its what I mentioned above)

curtosis19:04:55

realizing we're still alpha... has anyone looked at updating something like https://github.com/taylorSando/om-material-ui for om.next?

curtosis19:04:24

although for that matter... it looks like it only uses om-tools.dom from the om dependency, so maybe it's trivially updateable?

curtosis20:04:08

I picked on material-ui because that's the first one I was looking at, but the same situation applies to bootstrap-cljs

taylor.sando20:04:33

You should be able to use http://cljsjs.github.io/ to grab javascript dependencies. You can just use something like react-bootstrap.

curtosis20:04:16

yeah, I was just looking into how bootstrap-cljs does its thing. And there is indeed a react-mdl on CLJSJS.

taylor.sando20:04:10

Here is how I created an input element with react-bootstrap:

(defn -input [opts & children]
  (apply js/React.createElement js/ReactBootstrap.Input opts children))

taylor.sando20:04:19

opts would have to be a javascript object, so you would have to do #js or clj->js to the opts before sending, or change the -input function to make the conversion

curtosis20:04:37

hmm... that part seems straightforwardish

curtosis20:04:36

though of course it would be nice to be able to do (mui/input ...)

curtosis20:04:29

or (bs/input ...), naturally

curtosis20:04:06

I guess it's not strictly an om question at this point, though .. I'm just not grokking how e.g. bootstrap-cljs makes that magic happen yet.

taylor.sando20:04:54

They would just do it as a macro. You can generalize how I created that input element with a macro. The only thing that needs to change are the -input, and the js/ReatBootstrap.Input names.

curtosis20:04:28

doesn't that only happen under #?(:clj ...) though?

taylor.sando20:04:25

The macro can define functions that are used by cljs.

curtosis20:04:59

ah... so the magic happens when cljsbuild compiles it?

curtosis20:04:42

that's both cool and not intuitive. 😉

taylor.sando20:04:29

Well looking at https://github.com/luxbock/bootstrap-cljs/blob/master/src/bootstrap_cljs/core.cljc, there is a macro that calls a function that makes macros.

curtosis20:04:07

right, that's what I was looking at, and it makes perfect sense. I just couldn't figure out why that was running when compiling the file as cljs.

curtosis20:04:54

my naive brain sees the reader conditionals and mentally elides the forms for cljs, that is.

taylor.sando20:04:21

The cljs calls using bootstrap/input are macro calls that get converted at compile time.

curtosis20:04:58

that's clear; I'm just not understanding what causes core.cljc to run through a clj compile pass (to create the macros) before the cljs pass

curtosis20:04:45

no worries; it's not really an om question anyway.

seanirby21:04:38

Hey everyone, I thought I would share my om next app since its in a mostly working state. http://thescratchcastle.com/koeeoadi/ . Would appreciate any feedback if you have any.

dnolen21:04:20

@seanirby: hey that looks cool!

seanirby21:04:26

dnolen: thanks !

cjmurphy21:04:58

Yeah looks great. What do you use for css? I'm interested in how you get all those effects...

seanirby21:04:37

cjmurphy: i just used skeleton.css

cjmurphy21:04:28

I've never heard of that one - and I have been asking people what they use.

seanirby21:04:30

cjmurphy: regarding the effects. its nothing fancy, just plain css

cjmurphy21:04:18

I come from a Desktop background so css is a bit new to me. I'm using Semantic UI at the moment, which is great because no work to get things going. However I don't think it is great for building your own components. So at some point I'm thinking to go to something like basscss - or use another lightweight set like skeleton.css - when I 'get into' css. Will be interesting to see what people start to use with Om Next...

cjmurphy21:04:26

Your color picker is a component of some sort thou.. (from one of your commit messages I worked that out).

seanirby21:04:52

cjmurphy: yeah, chrome's native color input doesn't handle change events correctly so I had to use the color picker in the google closure library.

taylor.sando22:04:13

I was just looking over some of the closure. demos. I sometimes forget there is a bunch of ui components in the google closure library. https://google.github.io/closure-library/source/closure/goog/demos/

kendall.buchanan22:04:34

@hueyp: I know it’s been a few days, but I’m finally seeing how useful recursive parse is. In fact, I’m finding myself using it a lot. Is that a sign I’m not setting up my queries correctly?

hueyp22:04:06

its a pattern we use a lot but I have no idea if that is a good or bad thing simple_smile

kendall.buchanan22:04:12

Hehe, awesome, thanks.