-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix: Wrap route with location arg in location context #9094
Conversation
🦋 Changeset detectedLatest commit: 29f273b The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
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. |
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? |
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. |
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.
@mjackson, @ryanflorence, could you please take a look? I think a lot of people are eagerly waiting for this fix! |
Thanks @johnpangalos! Made a few small updates, but this looking good and I'll merge shortly |
Sounds good, glad to see this merged! Thanks @brophdawg11 |
Hi, there's something about this change that I wanted to ask about: having this bifurcation in the code, rendering two different component trees depending on whether there's a To illustrate, check at this short screen recording where I show how the component tree re-rendered in full, because the tree change after having introduced a CleanShot.2024-08-07.at.14.19.29.mp4Note how before the rendering commit took place, the tree starts with This is understandable due to how React reconciliation works. But it is undesirable, due to the potential to lose inner component state in this entire sub-tree. Proposed solutionWhat if we always wrap the return value of |
In order for the
useLocation
hook to work with the use of the modal pattern, routes with thelocationArg
prop are wrapped in aLocationContext
. This is done conditionally in order to ensure performance in the default case doesn't change.closes #8470