Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordering of componentDidMount events #76

Closed
sophiebits opened this issue Jun 9, 2013 · 2 comments · Fixed by #77
Closed

Ordering of componentDidMount events #76

sophiebits opened this issue Jun 9, 2013 · 2 comments · Fixed by #77

Comments

@sophiebits
Copy link
Collaborator

Currently, when mounting two nested components, componentDidMount fires on the outer element before the inner one:

http://jsfiddle.net/spicyj/udaq9/

I can't remember now why I was frustrated by this earlier in the week but I'd expect the inner component to be mounted completely before the outer component's componentDidMount method runs so that it can rely on the children being fully mounted.

Agree/disagree?

@zpao
Copy link
Member

zpao commented Jun 9, 2013

I can see why that would cause issues… The way you're thinking about sounds like common sense so I hope that's actually true and that we're just firing these callbacks in the wrong order. So I agree, but that's without looking at the code closely

@jordwalke
Copy link
Contributor

I think this makes sense. Here's my reasoning: One of the few valid reasons for wanting to use componentDidMount(node) (besides integrating with other frameworks) is to measure something's container. In order to do that accurately, the children might also want to have measured their own containers. For the parent's measurement to be accurate, the child's componentDidMount must have already completed.

@zpao zpao closed this as completed in #77 Jun 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants