Skip to content

Commit 13a8cce

Browse files
committed
chore: refactor detectedLocale assignment
1 parent ff7f82e commit 13a8cce

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

edge-runtime/lib/next-request.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,11 @@ const normalizeRequestURL = (
4646
nextConfig?: RequestData['nextConfig'],
4747
): { url: string; detectedLocale?: string } => {
4848
const url = new URL(originalURL)
49-
let detectedLocale: string | undefined
5049

5150
let pathname = removeBasePath(url.pathname, nextConfig?.basePath)
5251

53-
// If the i18n config is present, remove the locale from the URL and store it
54-
if (nextConfig?.i18n) {
55-
;({ detectedLocale } = normalizeLocalePath(pathname, nextConfig?.i18n?.locales))
56-
}
52+
// If it exists, remove the locale from the URL and store it
53+
const { detectedLocale } = normalizeLocalePath(pathname, nextConfig?.i18n?.locales)
5754

5855
if (!nextConfig?.skipMiddlewareUrlNormalize) {
5956
// We want to run middleware for data requests and expose the URL of the

0 commit comments

Comments
 (0)