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: Wrap route with location arg in location context #9094

Merged
merged 5 commits into from Sep 12, 2022
Merged

fix: Wrap route with location arg in location context #9094

merged 5 commits into from Sep 12, 2022

Conversation

johnpangalos
Copy link
Contributor

@johnpangalos johnpangalos commented Jul 25, 2022

In order for the useLocation hook to work with the use of the modal pattern, routes with the locationArg prop are wrapped in a LocationContext. This is done conditionally in order to ensure performance in the default case doesn't change.

closes #8470

@changeset-bot
Copy link

changeset-bot bot commented Jul 25, 2022

🦋 Changeset detected

Latest commit: 29f273b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
react-router Patch
react-router-dom Patch
react-router-dom-v5-compat Patch
react-router-native Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@johnpangalos
Copy link
Contributor Author

Not sure how changesets are meant to work, they aren't mentioned in contributing document but the changeset bot has kindly reminded me about them.

@johnpangalos
Copy link
Contributor Author

I also bumped the file sizes half a kB as it seems that the code I added is now breaking that limit. Is there any guidance as what should be done when reaching that limit?

@timdorr timdorr requested a review from brophdawg11 July 25, 2022 16:23
@timdorr
Copy link
Member

timdorr commented Jul 25, 2022

For the changesets, just follow the links in the comment above. This change should result in a patch version bump (it fixes a bug), so I would add one.

As for the size thing, that's fine to bump up just a little. It's mainly a protection against adding something stupidly huge in a PR without anyone noticing.

@johnpangalos johnpangalos changed the title Wrap route with location arg in location context fix: Wrap route with location arg in location context Jul 26, 2022
@brophdawg11
Copy link
Contributor

Thanks for the PR @johnpangalos! I left a comment over on #8470 but I'll ping Michael and Ryan on this as well to get their take

In order for the `useLocation` hook to work with the use of the modal
pattern, routes with the locationArg prop are wrapped in a
LocationContext. This is done conditionally in order to ensure
performance in the default case doesn't change.
@flying-sheep
Copy link

@mjackson, @ryanflorence, could you please take a look? I think a lot of people are eagerly waiting for this fix!

@brophdawg11
Copy link
Contributor

Thanks @johnpangalos! Made a few small updates, but this looking good and I'll merge shortly

@brophdawg11 brophdawg11 merged commit e766ab5 into remix-run:dev Sep 12, 2022
@johnpangalos
Copy link
Contributor Author

Sounds good, glad to see this merged! Thanks @brophdawg11

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

Successfully merging this pull request may close these issues.

[Bug]: useLocation inside <Routes location={location}> doesn't return given location
4 participants