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

fix(useParams): fix issue with useParams reading from null object #6940

Merged
merged 2 commits into from Sep 27, 2019
Merged

fix(useParams): fix issue with useParams reading from null object #6940

merged 2 commits into from Sep 27, 2019

Conversation

brandon-pereira
Copy link
Contributor

fixed by returning empty object if route not mounted

Closes #6938

fixed by returning empty object if route not mounted

Closes #6938
@timdorr
Copy link
Member

timdorr commented Sep 27, 2019

@mjackson Is this what you envision being returned from useParams if there is no match?

Copy link
Member

@timdorr timdorr left a comment

Choose a reason for hiding this comment

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

Needs a test.

@MeiKatz
Copy link
Contributor

MeiKatz commented Sep 27, 2019

I think returning null in this case is unexpected for me. The solution seems reasonable to me.

@brandon-pereira
Copy link
Contributor Author

@timdorr I've added tests and pushed the changes!

@MeiKatz Perfect! Glad we agree on this.

@timdorr
Copy link
Member

timdorr commented Sep 27, 2019

Cool, I'm going to merge this in as-is. If it's not what was expected, I'll put in a fix myself. Thanks!

@timdorr timdorr merged commit a32f779 into remix-run:master Sep 27, 2019
@mjackson mjackson mentioned this pull request Sep 27, 2019
23 tasks
@mjackson
Copy link
Member

mjackson commented Sep 27, 2019

@lock lock bot locked as resolved and limited conversation to collaborators Nov 26, 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.

Issue with useParams hook on unmounted component
4 participants