Skip to content

Commit

Permalink
[docs] Add iOS hydration mismatch details to error page (#43584)
Browse files Browse the repository at this point in the history
We recently ran into hydration mismatch errors on iOS, which we realised
was due to iOS automatically converting what it thought were phone
numbers into links.

We then found this GitHub issue,
#38290, and thought it would be
useful to add these details to the documentation page linked from the
next.js error.

---

Example from the linked issue:


![image](https://user-images.githubusercontent.com/712727/204925813-f986e2ca-29c2-4b63-9121-df4c7b00b1d8.png)

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
  • Loading branch information
josh- and timneutkens committed May 9, 2023
1 parent 81f5ed7 commit 5451564
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion errors/react-hydration-error.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,18 @@ Common causes with css-in-js libraries:
- When using other css-in-js libraries
- Similar to Styled Components / Emotion css-in-js libraries generally need configuration specified in their examples in the [examples directory](https://github.com/vercel/next.js/tree/canary/examples)

Local Overrides
Local Overrides:

It's possible you may have [Local Overrides enabled in Chrome devtools](https://developer.chrome.com/blog/new-in-devtools-65/#overrides). With this enabled, the HTML served will be different from what the SSR emitted. It also won't show up in view-source, so you may be left wondering what is going on.

Common causes on iOS:

- iOS attempts to detect phone numbers, email addressees and other data in text content and convert them into links, which can [lead to hydration mismatches](https://github.com/vercel/next.js/issues/38290). This can be disabled with the following `meta` tag:

```
<meta name="format-detection" content="telephone=no, date=no, email=no, address=no" />
```

### Useful Links

- [React Hydration Documentation](https://react.dev/reference/react-dom/client/hydrateRoot)
Expand Down

0 comments on commit 5451564

Please sign in to comment.