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

fix Uncaught Error: Minified React error #418; visit https://react.dev/errors/418 error due mismatch of last updated time date #4060

Merged
merged 2 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/famous-days-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextra-theme-docs": patch
---

fix `Uncaught Error: Minified React error #418; visit https://react.dev/errors/418` error due mismatch of last updated time date
24 changes: 8 additions & 16 deletions docs/app/docs/guide/i18n/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
icon: GlobeIcon
---

import { ExampleCode } from '@components/example-code'
import { Steps } from 'nextra/components'

# Next.js I18n
Expand Down Expand Up @@ -56,30 +57,21 @@ i18n: [
]
```

## Automatically detect and redirect to user-selected language (optional)
## Automatically detect and redirect to user-selected language (_optional_)

You can automatically detect the user's preferred language and redirect them to
the corresponding version of the site. To achieve this, create a `middleware.js`
file in the root of your project and export Nextra's middleware function from
`nextra/locales`:

```js filename="middleware.js" {1}
export { middleware } from 'nextra/locales'

export const config = {
// Matcher ignoring `/_next/` and `/api/`
matcher: [
'/((?!api|_next/static|_next/image|favicon.ico|icon.svg|apple-icon.png|manifest).*)'
]
}
```
the corresponding version of the site. To achieve this, create a `middleware.ts`
or `middleware.js` file in the root of your project and export Nextra's
middleware function from `nextra/locales`:

<ExampleCode example="swr-site" filePath="middleware.ts" metadata="{1}" />

> [!WARNING]
>
> This approach will not work for i18n sites that are statically exported with
> `output: 'export'` in `nextConfig`.

## Custom 404 page (optional)
## Custom 404 page (_optional_)

You can have a custom `not-found.jsx` with translations for an i18n website that
uses a shared theme layout. For guidance on implementing this, you can check out
Expand Down
6 changes: 5 additions & 1 deletion packages/nextra-theme-docs/src/components/last-updated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export const LastUpdated: FC<{
return (
<>
{children}{' '}
<time dateTime={date.toISOString()}>
<time
dateTime={date.toISOString()}
// Can provoke React 418 error https://react.dev/errors/418
suppressHydrationWarning
>
{date.toLocaleDateString(dateLocale, {
day: 'numeric',
month: 'long',
Expand Down
Loading