RickWong/react-transmit

switch between /posts/1 and posts/2 will not trigger queries

lilee opened this issue · 2 comments

because /posts/1 and /posts/2 route to the same handler, so componentWillMount can not be invoked. React Only invoke render function.

I think react-transimit should implement componentWillReceiveProps method, like

componentWillReceiveProps: function(nextProps) {
    var needToLoad = !shallowEqual(
        nextProps.queryParams,
        this.props.queryParams
    );
    if (needToLoad) {
        this.setQueryParams(nextProps.queryParams);
    }
}

the new react-router implements the similar function https://github.com/rackt/react-router/blob/master/modules/experimental/AsyncProps.js#L40

Thanks for reporting this, @lilee.

I submit the Pull Request