Skip to content

TypeError: Cannot read properties of undefined (reading 'locale') #469

Answered by desiboli
desiboli asked this question in Q&A
Discussion options

You must be logged in to vote

Ok I was able to fix this!

The RootLayout code above, I moved it outside of the [locale] folder but kept a copy of it inside the [locale] folder and renamed it to "LocaleLayout".

The RootLayout file code now looks like this:

// app/layout.tsx (direct copy from next-intl examples https://github.com/amannn/next-intl/blob/main/examples/example-next-13-next-auth/src/app/layout.tsx

import { type ReactNode } from "react"

import "@/styles/globals.css"

type Props = {
  children: ReactNode
}

// Even though this component is just passing its children through, the presence
// of this file fixes an issue in Next.js 13.3.0 where link clicks that switch
// the locale would otherwise be ignored.
expo…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by desiboli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working unconfirmed Needs triage.
2 participants
Converted from issue

This discussion was converted from issue #468 on August 22, 2023 15:22.