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

perf(next-international): optimize middleware #292

Merged
merged 6 commits into from
Nov 21, 2023

Conversation

Yovach
Copy link
Contributor

@Yovach Yovach commented Nov 19, 2023

Copy link

vercel bot commented Nov 19, 2023

Someone is attempting to deploy a commit to a Personal Account owned by @QuiiBz on Vercel.

@QuiiBz first needs to authorize it.

Copy link
Owner

@QuiiBz QuiiBz left a comment

Choose a reason for hiding this comment

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

Thanks for the comments and improvements! Left a suggestion:

if (noLocalePrefix(config.locales, requestUrl.pathname)) {
requestUrl.pathname = `/${locale}${requestUrl.pathname}`;
// If the locale from the request is not an handled locale, then redirect to the same URL with the default locale
if (!hasHandledLocale(config.locales, nextUrl.pathname)) {
Copy link
Owner

Choose a reason for hiding this comment

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

Not a fan of the updated function name + the negation. Could we revert the changes?

Copy link
Owner

@QuiiBz QuiiBz left a comment

Choose a reason for hiding this comment

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

Just tested and everything seems to work as expected, thanks!

@QuiiBz QuiiBz changed the title perf: optimize middleware perf(next-international): optimize middleware Nov 21, 2023
@QuiiBz QuiiBz merged commit e4acd2f into QuiiBz:main Nov 21, 2023
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants