ckirkendall / kioo

Enlive/Enfocus style templating for Facebook's React and Om in ClojureScript.
Eclipse Public License 1.0
404 stars 39 forks source link

Using lifecycle appears to break rendering #38

Closed solussd closed 9 years ago

solussd commented 9 years ago

Hello! It's possible I'm using lifecycle incorrectly, but it doesn't seem to be working as expected.

Lifecycle functions get called, but snippets don't get rendered. E.g.,

(defsnippet mysnippet "some.html" [:#snippet]
  [data]
  {[:h1] (content "hello")})

(deftemplate mytemplate "main.html"
  [data]
  {[:#container] (do-> (content (mysnippet data))
                       (lifecycle {:will-mount (fn [this] (.log js/console "mounted!"))}))})

"mounted" will be printed to the console, but mysnippet doesn't render.

kioo.utils/WrapComponent supplies implementations for lifecycle functions as well as render and shouldComponentUpdate, but it looks like it expects them all to be implemented in a lifecycle function map.

ckirkendall commented 9 years ago

Not sure what is going on here. I did notice you have a type where you the lifecycle method is in the content expression.

solussd commented 9 years ago

ah, yes, that was a typo (fixed).

solussd commented 9 years ago

Is using lifecycle with a do-> supported? It looks like it should be.