Thanks for the link David. Just for the record, I found the source of my confusion. I didn't take in account that the child components only had access to a subset of the app-state their parent received (via a cursor). By taking that in account, now is clear that any change to the app-state portion the child depends must also trigger a re-rendering of the parent. The case I was analyzing, a dirty child with a clear parent, is impossible.
Saludos, Nahuel Greco. On Wed, Apr 23, 2014 at 3:30 PM, David Nolen <[email protected]> wrote: > I recommend the React documentation if you are curious how it works > http://facebook.github.io/react/docs/reconciliation.html. > > David > > > On Wed, Apr 23, 2014 at 2:27 PM, Nahuel Greco <[email protected]> wrote: > >> So all component instances are created on the first render and then React >> stores them internally? What happens if you redefine a component function >> making it returning a different set of components, how Om/React knows the >> function must be run again so the new components are instantiated and >> replaces the old ones? You need to trigger a full render/reinstancing >> manually after redefinitions like that? How? >> >> >> >> Saludos, >> Nahuel Greco. >> >> >> On Wed, Apr 23, 2014 at 11:14 AM, David Nolen <[email protected]>wrote: >> >>> On Wed, Apr 23, 2014 at 3:34 AM, Nahuel Greco <[email protected]> wrote: >>> >>>> Analyzing Om source, I see the following code path executed everytime >>>> you change the application state: >>>> >>>> 1- om/render-all is called as a callback for requestAnimationFrame >>>> 2- dom/render is called for each root binding >>>> 3- om/build is called for the component function of the root binding, >>>> component is instantiated and wrapped in a om/Pure class. Child components >>>> are NOT instantiated because the render/render-state function is not yet >>>> called. >>>> 4- React.renderComponent is called for the newly instantiated root >>>> component >>>> 5- React.renderComponent calls the shouldComponentUpdate from the Pure >>>> class. >>>> 6- shouldComponentUpdate (for example) returns false as the component >>>> doesn't needs to be updated because the data pointed by his cursor didn't >>>> changed >>>> 7- because no update is needed, React.renderComponent never calls >>>> render/render-state, so the children components (if any) are never >>>> instantiated >>>> >>>> So my question is: How React knows if there are *children* components >>>> needing updating, if they are never instantiated when his parent (owner?) >>>> returns false to shouldComponentUpdate? >>>> >>> >>> Everything gets instantiated during the first render. >>> >>> David >>> >>> -- >>> 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. >> > > -- > 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.
