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

Make sure props.url is immutable #4352

Merged
merged 3 commits into from
May 12, 2018

Conversation

timneutkens
Copy link
Member

@timneutkens timneutkens commented May 12, 2018

The deprecation of the automatic url injection introduced this, basically router is mutable, and getting the value at call time will break when someone checks it in componentWillUpdate or similar.

@leo leo self-requested a review May 12, 2018 16:30
@timneutkens timneutkens merged commit 449f38d into vercel:canary May 12, 2018
@timneutkens timneutkens deleted the fix/url-prop-state branch May 12, 2018 18:12
@oliviertassinari
Copy link
Contributor

oliviertassinari commented May 13, 2018

@timneutkens Should we make the router values immutable too?
I have been facing this issue moving from the deprecated url property to the withRouter pattern.
I have noticed the following between two renders: the this.props.router property didn't change, but this.props.router.pathname value changed.

lependu pushed a commit to lependu/next.js that referenced this pull request Jun 19, 2018
* Make sure props.url is immutable

* Add test for immutable url

* Match object instead of string
@lock lock bot locked as resolved and limited conversation to collaborators May 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants