Hi,

Changes to app state *can* cause components to be unmounted. Imagine a 
component that renders another component, if a boolean value in the app state 
is true, otherwise it renders and empty div. When the boolean changes from true 
to false and the component is re-rendered, the subcomponent will be unmounted. 

However, if the subcomponent should be re-rendered in both cases, it should not 
be unmounted. 

Thinking about it, you're probably mistakenly using a different react-key 
between the renders. This will cause a new component to be mounted as it is not 
treated as a continuation of the previous component. 

Lucas


> On 4 Dec 2014, at 19:29, Colin Yates <[email protected]> wrote:
> 
> Hi all,
> 
> I am seeing a component consistently unmount/remount every time the 
> application state changes. If I change the local state instead then it 
> doesn't umount but simply re-renders as I expected.
> 
> I didn't expect changes in app-state to cause an unmount/remount only a 
> re-render (as that is my understanding of React's lifecycle). Further, since 
> I am talking about this my assumption (and the behaviour I am seeing) is that 
> om will only call the render protocol method if the values have actually 
> changed.
> 
> If my assumptions are correct I will see if I can reduce the problem into a 
> simple gist.
> 
> The reason this is a pain, performance aside, is because a re-mount loses 
> focus and this specific component is a text field. I notice in the discussion 
> on text-fields in the Basic tutorial "text" is component local, maybe now I 
> understand why as this seemed to me to go against the grain of what is 
> advised to go into local state...
> 
> Can somebody please clarify?
> 
> Thanks!
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to