This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-20
Channels
- # admin-announcements (5)
- # alda (1)
- # aws-lambda (1)
- # beginners (74)
- # boot (62)
- # cider (29)
- # cljs-dev (36)
- # cljsjs (15)
- # cljsrn (34)
- # clojure (58)
- # clojure-android (3)
- # clojure-austin (15)
- # clojure-austria (11)
- # clojure-dusseldorf (25)
- # clojure-germany (6)
- # clojure-greece (26)
- # clojure-quebec (8)
- # clojure-russia (50)
- # clojure-spec (12)
- # clojure-uk (8)
- # clojurescript (46)
- # core-async (11)
- # cursive (22)
- # datomic (2)
- # devcards (27)
- # dirac (5)
- # hoplon (109)
- # jobs (1)
- # kekkonen (2)
- # lein-figwheel (12)
- # leiningen (2)
- # microservices (1)
- # off-topic (3)
- # om (70)
- # onyx (17)
- # planck (21)
- # re-frame (3)
- # reagent (2)
- # rum (1)
- # spacemacs (12)
- # spirituality-ethics (9)
- # untangled (44)
- # vim (2)
- # yada (8)
Looks great! Somehow it feels like not enough people care about server-side rendering, but to me it's a killer feature.
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 ?
@hmadelaine: I’m not sure I understand the question?
is it a Cellophane specific question?
@anmonteiro: yes, it concerns Cellophane, and the way to initialise the rendering using a Component with params
@hmadelaine: What would you do in Om that you can’t do in Cellophane?
@anmonteiro: I can use set-query!
you can do that too 🙂
Cellophane will run componentWillMount
before rendering
You did reimplement the whole Om Next !
yea, kind of 🙂
it’s the only way you could have .cljc
files
without having to put certain things behind reader conditionals
it’s already enough to do it for platform specific things
Thank you very much @anmonteiro
@anmonteiro: we should talk about how to merge this stuff in at some point 🙂
@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
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
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)]
…
@hmadelaine: I think you’ll probably want to do whatever you would do in Om
e.g. you could change the query in componentWillMount
@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 componentWillMount
will trigger a remote data fetching ?
@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?
e.g. (cellophane.dom/render-to-str ((cellophane/factory Todos) props-you-obtained-independently))
@anmonteiro: yes you are right, this is the best way to go. Thanks again
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
@peeja: I’m not sure I understand the question
what is a-stateless-component
? something created via factory
?
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.
is this true?
Seems a little bit strange
@anmonteiro: No, a-stateless-component
is a function that returns a React element
@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.
@peeja: the reason I don’t understand the question is because both factories and things in om.dom
call js/React.createElement
so React does know about things being created
Let's say I've got a fancy-button
function, and it does (om.dom/button {:className "fancy"})
I may as well have inlined (om.dom/button {:className "fancy"})
into the other component
@peeja: I think I’m still not following
React.createElement
is what leverages the React reconciler AFAIK
so your function ends up calling that, via the om.dom/button
and in its component tree, it understands that the button
is owned by a fancy_button
component
What I'm thinking of is this: https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html#components-can-be-classes-or-functions
@peeja: sorry having issues with my connection
I’m not familiar with that way of declaring components
I don’t think that’s comparable to what you’re asking, though
every element you declare in Om will call React.createElement
so it has a position in React’s reconciler
it doesn’t matter whether it’s “replaced” or not by a function
@anmonteiro: Here's some code demonstrating what I'm describing. https://github.com/Peeja/om-next-starter/blob/functional-components/src/om_starter/core.cljs#L79-L96
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.kay: happy to look at a failing example to confirm your suspicions
any tips? I would expect it to be broken everywhere if it is broken for me in this case.
@tony.kay: let me try it out in Om’s devcards
something in my env probably. I'm using checkouts trying to extend a library bit...just weird
@tony.kay: yea, everything seems fine here
Yeah, only some of my lifecycle methods are being called as well. shouldComponentUpdate never gets called, though componentDidMount does.
Trying this om.next question over here to see if someone has an answer. https://clojurians.slack.com/archives/om-next/p1465854849000004