Skip to content

Conversation

edorivai
Copy link
Collaborator

@edorivai edorivai commented Sep 3, 2018

This is my first stab at implementing the two-pass render as described in #81.

It replaces componentWillMount for componentDidMount, which should address SSR related issues outlined in #91. As well as prepares for the deprecation of componentWillMount.

It has an optimization for the "basic" case; if defaultMatches is not specified, it will not trigger the two-pass render. So you'll only incur the additional two-pass render cost if you actually specify defaultMatches for SSR, in which case the two-pass is actually recommended by the React team.

@mjackson I'd really appreciate a review before merging it in. Also, I've decided to build this on top of @next, just so I don't have to write it twice. If you prefer to have this backported into v1, I can look into that.

Cheers!

? this.props.defaultMatches
: this.getMatches()
};
this.onChange();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure whether we should be calling onChange in the constructor. I added it now because this is in line with the current behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant