Skip to content

Commit b2c61fb

Browse files
docs(hydration errors): Add a FAQ entry about strange html diffs (#14672)
The original ticket was something like "Sentry raises attribute order or empty spaces in values as Hydration errors that have no effect on the HTML rendering" I wrote a response on the ticket, but since this is a common enough thing I think it should be in the FAQ too. It's a good question that we've gotten before. Fixes getsentry/sentry#97828 <img width="764" height="736" alt="SCR-20250815-jnqv" src="https://github.com/user-attachments/assets/14e2dfae-27bd-43f6-aa9f-9b087e7b11be" /> --------- Co-authored-by: Michelle Zhang <[email protected]>
1 parent ca25d21 commit b2c61fb

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

docs/product/issues/issue-details/replay-issues/hydration-error.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ To make debugging easier, adjust the diff boundary to show more changes before o
6363

6464
![html diff tool](./img/hydration-error-adjust-bounds.png)
6565

66+
### The HTML view shows extra changes that do not impact the HTML rendering
67+
68+
Sometimes you will see changes to the HTML like attribute being removed, order changing, spaces being removed, or strange classes like `:hover` appearing. These parts of the diff do not impact the HTML that the user sees, and often are not the cause of the hydration error.
69+
70+
This is expected and a side effect of how we capture debugging data after a Hyration Error has occurred.
71+
72+
Some common examples:
73+
74+
![html diff tool](./img/hydration-diff-hover.png)
75+
76+
An attribute `xmlns="http://www.w3.org/2000/svg"` was removed. This is an XML attribute and is not needed within a valid HTML page, so React did not include it in the render.
77+
78+
![html diff tool](./img/hydration-diff-xmlns.png)
79+
80+
The class name `:hover` was added Session Replay when it serialized the page, React didn't see this class and it has no impact on hydration. This means the user was hovering and interacting with the page before react was finished hydrating (this is the whole point of hydration; to make the page react for interaction sooner!). By the time hydration was complete the user had moved their mouse so the :hover class is changed.
81+
6682
## Privacy
6783

6884
The diff tools all rely on replay data, so any PII data within the webpage will be masked or blocked before being sent to the server by default. Read more about [Protecting user privacy in Session Replay](/security-legal-pii/scrubbing/protecting-user-privacy/) and [how to configure Session Replay to maintain user privacy](/platforms/javascript/session-replay/privacy/).
79.7 KB
Loading
91.5 KB
Loading

0 commit comments

Comments
 (0)