File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
packages/next/src/next-devtools/dev-overlay/components/devtools-indicator Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 1
- import { useEffect , useRef , useState } from 'react'
1
+ import { useRef , useState } from 'react'
2
2
import { useUpdateAnimation } from './hooks/use-update-animation'
3
3
import { useMeasureWidth } from './hooks/use-measure-width'
4
4
import { useMinimumLoadingTimeMultiple } from './hooks/use-minimum-loading-time-multiple'
@@ -28,6 +28,12 @@ export function NextLogo({
28
28
29
29
const hasError = totalErrorCount > 0
30
30
const [ isErrorExpanded , setIsErrorExpanded ] = useState ( hasError )
31
+ const [ previousHasError , setPreviousHasError ] = useState ( hasError )
32
+ if ( previousHasError !== hasError ) {
33
+ setPreviousHasError ( hasError )
34
+ // Reset the expanded state when the error state changes
35
+ setIsErrorExpanded ( hasError )
36
+ }
31
37
const [ dismissed , setDismissed ] = useState ( false )
32
38
const newErrorDetected = useUpdateAnimation (
33
39
totalErrorCount ,
@@ -43,11 +49,6 @@ export function NextLogo({
43
49
const isExpanded = isErrorExpanded || state . disableDevIndicator
44
50
const width = measuredWidth === 0 ? 'auto' : measuredWidth
45
51
46
- useEffect ( ( ) => {
47
- // eslint-disable-next-line react-hooks/react-compiler -- TODO
48
- setIsErrorExpanded ( hasError )
49
- } , [ hasError ] )
50
-
51
52
return (
52
53
< div
53
54
data-next-badge-root
You can’t perform that action at this time.
0 commit comments