Skip to content

Commit 36dc0af

Browse files
ryan953coolguyzone
authored andcommitted
docs(replay): Document new hydration tree compare, and update related images (#11883)
* docs(replay): Document new hydration tree compare, and update related images * Apply suggestions from code review Co-authored-by: Alex Krawiec <[email protected]> --------- Co-authored-by: Alex Krawiec <[email protected]>
1 parent 4185967 commit 36dc0af

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,35 @@ Hydration errors represent a mismatch between the server-rendered HTML, and the
1919

2020
Generally, the visual tools are a good place to start to identify the issue, but keep in mind that sometimes differences can appear below the fold, or there can be differences in hidden DOM nodes or attributes, so inspecting the HTML is important too.
2121

22-
### Example Error
22+
#### Example Error
2323

2424
In the example below we'll look at a hydration error and see how each tool helps to debug the problem.
2525

2626
The problem is that code highlighting is not applied on the server. When the server renders the PHP code block in the bottom-center of the page, all the code has a white font color. After hydration syntax highlighting is applied, the code snippet is colorful.
2727

28-
#### Image Slider Tool
28+
### Image Slider
2929

3030
The image slider tool allows for comparing the two page states by overlaying the images on top of each other. Click and drag the purple line to reveal one image or the other.
3131

3232
![image slider tool](./img/hydration-error-image-slider-tool.png)
3333

34-
#### Side-by-Side Image Tool
34+
### Side-by-Side Image
3535

3636
View images side-by-side to see large chunks of the page that may differ.
3737

3838
![side by side image tool](./img/hydration-error-side-by-side-image-tool.png)
3939

40-
#### HTML Diff Tool
40+
### Tree Compare
41+
42+
Use the tree compare tool to list specifically which DOM nodes were added, removed, or had attributes changed.
43+
44+
You can see each change to the page, and when it happened within the context of the hydration error. In this case one mutation happened at the timestamp `1732089574790` which was at time offset `1790`, or 1.7 seconds since the start of the captured replay. Within this mutation 39 nodes were added, 2 nodes had some attributes changed, and 4 nodes were removed.
45+
46+
We show a CSS selector for each node in the tree to make it easier to identify the component that was changed. Note that some changed nodes might exist outside your React render tree and won't cause hydration errors.
47+
48+
![tree compare tool](./img/hydration-error-tree-compare-tool.png)
49+
50+
### HTML Diff
4151

4252
The HTML diff tool is a basic HTML comparison. It is useful if the hydration error is caused by hidden DOM nodes, different attributes on a DOM node, or there's mismatched content below the fold.
4353

11 KB
Loading
213 KB
Loading
-63.7 KB
Loading
520 KB
Loading

0 commit comments

Comments
 (0)