7b6a61a750
When visiting a non-locale prefixed path (`/hello` instead of `/fr/hello`) we don't trigger locale redirects currently so if another locale is matched we need to ensure this is reset to the `defaultLocale` for rendering to prevent a mis-match on the client and the server. This also fixes hydration errors from occurring with `asPath` for `getServerSideProps` pages due to `normalizeLocalePath` expecting only a pathname and `asPath` containing `hash` and `query values also. Fixes: https://github.com/vercel/next.js/issues/18337 Fixes: https://github.com/vercel/next.js/issues/18510
19 lines
478 B
JavaScript
19 lines
478 B
JavaScript
if (typeof window !== 'undefined') {
|
|
window.caughtWarns = []
|
|
|
|
const origWarn = window.console.warn
|
|
const origError = window.console.error
|
|
|
|
window.console.warn = function (...args) {
|
|
window.caughtWarns.push(args.join(' '))
|
|
origWarn(...args)
|
|
}
|
|
window.console.error = function (...args) {
|
|
window.caughtWarns.push(args.join(' '))
|
|
origError(...args)
|
|
}
|
|
}
|
|
|
|
export default function MyApp({ Component, pageProps }) {
|
|
return <Component {...pageProps} />
|
|
}
|