-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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(i18n): parse params and props correctly with fallback #12709
Conversation
🦋 Changeset detectedLatest commit: de2584d The changes in this PR will be included in the next version bump. 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 |
CodSpeed Performance ReportMerging #12709 will not alter performanceComparing Summary
|
LMK if this is too many tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an amazing fix, thank you @mtwilliams-code for that!
Changes
This modifies the logic in getParams and getProps slightly to handle i18n fallback edge cases.
If there are no static path matches in getProps, we return early to avoid an error that occurs in the
findPathItemByKey
call. This should be a nonbreaking change - I dont see any side effects from these calls and it returns an empty object anyway if there are no static paths. I'm not entirely sure I understand the intended behavior in all scenarios here, so feel free to correct.In
getParams
If there are no param matches fromroute.pattern
, we also try the patterns fromroute.fallbackRoutes
so that we correctly parse out the param from the localized URL.Fixes #12701
Testing
Change to the i18n-routing-fallback fixture to allow testing SSR params and a new test added for
Fallback rewrite SSR
to validate the param is received correctly. Before this change this test will crash withDocs
This fixes a bug and restores intended behavior, so no docs necessary.