1
1
import {
2
- getDefaultHydrationErrorMessage ,
3
2
isHydrationError ,
4
3
testReactHydrationWarning ,
5
4
} from '../is-hydration-error'
6
5
import {
7
6
hydrationErrorState ,
8
7
getReactHydrationDiffSegments ,
8
+ type HydrationErrorState ,
9
9
} from './hydration-error-info'
10
10
11
11
export function attachHydrationErrorState ( error : Error ) {
@@ -27,15 +27,14 @@ export function attachHydrationErrorState(error: Error) {
27
27
if ( reactHydrationDiffSegments ) {
28
28
const diff = reactHydrationDiffSegments [ 1 ]
29
29
parsedHydrationErrorState = {
30
- ...( error as any ) . details ,
30
+ ...( ( error as any ) . details as HydrationErrorState ) ,
31
31
...hydrationErrorState ,
32
32
// If diff is present in error, we don't need to pick up the console logged warning.
33
33
// - if hydration error has diff, and is not hydration diff log, then it's a normal hydration error.
34
34
// - if hydration error no diff, then leverage the one from the hydration diff log.
35
35
36
- warning : ( diff && ! isHydrationWarning
37
- ? null
38
- : hydrationErrorState . warning ) || [ getDefaultHydrationErrorMessage ( ) ] ,
36
+ warning :
37
+ diff && ! isHydrationWarning ? undefined : hydrationErrorState . warning ,
39
38
// When it's hydration diff log, do not show notes section.
40
39
// This condition is only for the 1st squashed error.
41
40
notes : isHydrationWarning ? '' : reactHydrationDiffSegments [ 0 ] ,
0 commit comments