not-found.tsx -> TypeError: Cannot read properties of undefined (reading 'Provider')
Answered
dperolio posted this in #help-forum
dperolioOP
This only seems to happen with this page. For some reason, it gives this error, and then refreshing with command + shift + r loads the not found page normally. Then if you try to go to a different page that isn't found, the same thing happens.
4 Replies
dperolioOP
My layout.tsx looks like this
import { AuthProvider, UserSettingsProvider } from '#components';
export { viewport, metadata } from './[locale]/layout';
import '../styles/global.scss';
export default async function RootLayout ({ children }: { children: React.ReactNode }) {
return (
<AuthProvider user={null}>
<UserSettingsProvider lang='en'>
<html lang='en' dir='ltr' suppressHydrationWarning>
<body className='min-h-screen text-white'>
{children}
</body>
</html>
</UserSettingsProvider>
</AuthProvider>
);
}
Normal pages work fine parallel to not-found.tsx, using the same layout. :/
Converting a page component from server to client though, results in it loading the page then a second later showing a blank white page. command + shift + r fixes it as with not-found.tsx, until you refresh / go back to the page.
Answer