Fork me on GitHub
#om
<
2016-06-20
>
kauko04:06:07

Looks great! Somehow it feels like not enough people care about server-side rendering, but to me it's a killer feature.

hkjels06:06:11

I think Cellophane should just be part of om.next

afhammad11:06:58

are there any examples of om.next with a non datomic db backend?

hmadelaine13:06:21

Hi @anmonteiro ! Nice work ! I am playing with Cellophane and the fullstack-example and I wonder how I could pass params to the root Component ?

anmonteiro13:06:33

@hmadelaine: I’m not sure I understand the question?

anmonteiro13:06:39

is it a Cellophane specific question?

hmadelaine13:06:23

@anmonteiro: yes, it concerns Cellophane, and the way to initialise the rendering using a Component with params

anmonteiro13:06:05

@hmadelaine: What would you do in Om that you can’t do in Cellophane?

hmadelaine13:06:59

@anmonteiro: I can use set-query!

anmonteiro13:06:09

you can do that too 🙂

anmonteiro13:06:24

Cellophane will run componentWillMount before rendering

hmadelaine13:06:42

You did reimplement the whole Om Next !

anmonteiro13:06:48

yea, kind of 🙂

anmonteiro13:06:18

it’s the only way you could have .cljc files

anmonteiro13:06:43

without having to put certain things behind reader conditionals

anmonteiro13:06:03

it’s already enough to do it for platform specific things

hmadelaine13:06:00

Thank you very much @anmonteiro

dnolen13:06:26

@anmonteiro: we should talk about how to merge this stuff in at some point 🙂

anmonteiro13:06:16

@dnolen: shouldn’t be too hard except porting the Om Next tests too. I think there are some still some rough edges in Cellophane, implementation-wise, which is why I haven’t brought it up yet

anmonteiro13:06:20

e.g. I’ve been working on making the string generation faster, and avoiding the need to :import components in the Clojure side of things, but there is some other stuff which needs more love

hmadelaine14:06:52

hi again @anmonteiro ! I am struggling a little bit with the manipulation of the query/params. In the fullstack-example, I am trying to change the query in the page.clj but with no success. Is it the correct place and timing ?

(defn render-page [{:keys [datomic-connection] :as req}]
  (let [r (td/make-reconciler datomic-connection)
        c (om/add-root! r td/Todos nil)
        html-string (dom/render-to-str c)]
…

anmonteiro14:06:11

@hmadelaine: I think you’ll probably want to do whatever you would do in Om

anmonteiro14:06:28

e.g. you could change the query in componentWillMount

hmadelaine14:06:07

@anmonteiro: my goal is to generate a static view in a specific state. Correct me if I am wrong but changing the query in the componentWillMountwill trigger a remote data fetching ?

anmonteiro14:06:06

@hmadelaine: if you want a static view in a specific state, and that seems specific to the Clojure server side of things, maybe you can fetch the props independently, and use the component factory constructor?

anmonteiro14:06:45

e.g. (cellophane.dom/render-to-str ((cellophane/factory Todos) props-you-obtained-independently))

hmadelaine14:06:38

@anmonteiro: yes you are right, this is the best way to go. Thanks again

peeja15:06:53

Started to ask a question, but it got a bit long for Slack: Should “component” functions in Om be called directly? http://stackoverflow.com/questions/37926569/should-component-functions-in-om-be-called-directly

dnolen16:06:42

cut 1.0.0-alpha37

dnolen16:06:59

some fixes + removes annoying warnings if you’re using the Clojure 1.9.0 alphas

anmonteiro16:06:10

@peeja: I’m not sure I understand the question

anmonteiro16:06:12

what is a-stateless-component? something created via factory?

iwankaramazow16:06:30

Here, a-stateless-component is called immediately, and whatever it returns is inserted directly into the div, rather than being substituted later by the React reconciler.

iwankaramazow16:06:40

Seems a little bit strange

peeja17:06:07

@anmonteiro: No, a-stateless-component is a function that returns a React element

peeja17:06:23

@iwankaramazow: Well, it has to be true: I'm just calling a function, and it's returning a React element. The reconciler never knows that I generated it from a function.

anmonteiro17:06:02

@peeja: the reason I don’t understand the question is because both factories and things in om.dom call js/React.createElement

anmonteiro17:06:25

so React does know about things being created

peeja17:06:40

React doesn't know that I used my function to create it, though

peeja17:06:15

Let's say I've got a fancy-button function, and it does (om.dom/button {:className "fancy"})

peeja17:06:43

Then later, I call (fancy-button) in another component

peeja17:06:04

React knows I built a button, but it doesn't know I built a fancy-button

peeja17:06:29

I may as well have inlined (om.dom/button {:className "fancy"}) into the other component

anmonteiro17:06:45

@peeja: I think I’m still not following

anmonteiro17:06:59

React.createElement is what leverages the React reconciler AFAIK

anmonteiro17:06:21

so your function ends up calling that, via the om.dom/button

peeja17:06:50

Right, but the "React way" would be to call React.createElement(fancy_button)

peeja17:06:17

Then the reconciler calls fancy_button later

peeja17:06:42

and in its component tree, it understands that the button is owned by a fancy_button component

anmonteiro17:06:49

@peeja: sorry having issues with my connection

anmonteiro17:06:19

I’m not familiar with that way of declaring components

anmonteiro17:06:42

I don’t think that’s comparable to what you’re asking, though

anmonteiro17:06:13

every element you declare in Om will call React.createElement so it has a position in React’s reconciler

anmonteiro17:06:31

it doesn’t matter whether it’s “replaced” or not by a function

tony.kay21:06:53

Is anyone having problems with component local state re-render? Could be a problem on my end, but I've been tinkering for 30 mins and I am starting to be suspicious

tony.kay21:06:07

on alpha37 with react 15

anmonteiro21:06:01

@tony.kay: happy to look at a failing example to confirm your suspicions

tony.kay21:06:32

any tips? I would expect it to be broken everywhere if it is broken for me in this case.

anmonteiro21:06:20

@tony.kay: let me try it out in Om’s devcards

tony.kay21:06:57

something in my env probably. I'm using checkouts trying to extend a library bit...just weird

anmonteiro21:06:25

@tony.kay: yea, everything seems fine here

tony.kay21:06:18

ok. Figured

tony.kay21:06:34

I'm suspecting dependency weirdness

tony.kay22:06:58

Yeah, only some of my lifecycle methods are being called as well. shouldComponentUpdate never gets called, though componentDidMount does.

tony.kay22:06:12

verified arity...just weird

danburton23:06:56

Trying this om.next question over here to see if someone has an answer. https://clojurians.slack.com/archives/om-next/p1465854849000004