Is it possible to destroy an om component ?

133 views
Skip to first unread message

Roger Gilliar

unread,
May 7, 2014, 3:28:19 PM5/7/14
to clojur...@googlegroups.com
I have the following component:

(defn- component [services owner]

(reify

om/IInitState
(init-state [_]
(println "init-state")
{:selected-service (:name (first services))
})

om/IRenderState
(render-state [_ state]
(println services)
(dom/div nil))


And I create it like this:
(om/build (service-info/create
(get-in app-state [:selected-domain :domain]) select-service-chan)
(get-in app-state[:selected-domain :services]))


init-state is only called the first time the above code is called. Is this expected ? If it is, how can I completely destroy the component and start from scratch ?

Bruce Hauman

unread,
May 7, 2014, 4:28:46 PM5/7/14
to clojur...@googlegroups.com

Roger Gilliar

unread,
May 7, 2014, 4:33:55 PM5/7/14
to clojur...@googlegroups.com
This event is called if the element is unmounted. But how do i unmount a component ?

Bruce Hauman

unread,
May 7, 2014, 4:35:04 PM5/7/14
to clojur...@googlegroups.com
If you want to unmount a component just don't render it :)  It's that easy.  


On Wed, May 7, 2014 at 4:33 PM, Roger Gilliar <roger....@googlemail.com> wrote:
This event is called if the element is unmounted. But how do i unmount a component ?

--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/ul5L7Qa5yjg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply all
Reply to author
Forward
0 new messages