Commit 3153c88
Add Diffs to Hydration Warnings (facebook#28512)
Stacked on facebook#28502.
This builds on the mechanism in facebook#28502 by adding a diff of everything
we've collected so far to the thrown error or logged error.
This isn't actually a longest common subsequence diff. This means that
there are certain cases that can appear confusing such as a node being
added/removed when it really would've appeared later in the list. In
fact once a node mismatches, we abort rendering so we don't have the
context of what would've been rendered. It's not quite right to use the
result of the recovery render because it can use client-only code paths
using useSyncExternalStore which would yield false differences. That's
why diffing the HTML isn't quite right.
I also present abstract components in the stack, these are presented
with the client props and no diff since we don't have the props that
were on the server. The lack of difference might be confusing but it's
useful for context.
The main thing that's data new here is that we're adding some siblings
and props for context.
Examples in the [snapshot
commit](facebook@e14532f).1 parent 94fc49c commit 3153c88
File tree
4 files changed
+926
-33
lines changed- packages
- react-dom-bindings/src/client
- react-dom/src/__tests__
- react-reconciler/src
4 files changed
+926
-33
lines changedLines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| |||
1829 | 1829 | | |
1830 | 1830 | | |
1831 | 1831 | | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
1832 | 1844 | | |
1833 | 1845 | | |
1834 | 1846 | | |
1835 | 1847 | | |
1836 | 1848 | | |
1837 | | - | |
| 1849 | + | |
1838 | 1850 | | |
1839 | 1851 | | |
1840 | 1852 | | |
| |||
0 commit comments