Skip to content

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

Merged
timdorr merged 2 commits into
remix-run:masterfrom
brandon-pereira:feature/useParams-fix
Sep 27, 2019
Merged

fix(useParams): fix issue with useParams reading from null object#6940
timdorr merged 2 commits into
remix-run:masterfrom
brandon-pereira:feature/useParams-fix

Conversation

@brandon-pereira

Copy link
Copy Markdown
Contributor

fixed by returning empty object if route not mounted

Closes #6938

fixed by returning empty object if route not mounted

Closes #6938
@timdorr

timdorr commented Sep 27, 2019

Copy link
Copy Markdown
Member

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

@timdorr timdorr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Needs a test.

@MeiKatz

MeiKatz commented Sep 27, 2019

Copy link
Copy Markdown
Contributor

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

@brandon-pereira

Copy link
Copy Markdown
Contributor Author

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

@MeiKatz Perfect! Glad we agree on this.

@timdorr

timdorr commented Sep 27, 2019

Copy link
Copy Markdown
Member

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

mjackson commented Sep 27, 2019

Copy link
Copy Markdown
Member

@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