File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ export default function useStatus(
5252
5353 const mountedRef = useRef ( false ) ;
5454 const deadlineRef = useRef ( null ) ;
55+ const destroyedRef = useRef ( false ) ;
5556
5657 // =========================== Dom Node ===========================
5758 const cacheElementRef = useRef < HTMLElement > ( null ) ;
@@ -83,7 +84,8 @@ export default function useStatus(
8384 canEnd = onLeaveEnd ?.( element , event ) ;
8485 }
8586
86- if ( canEnd !== false ) {
87+ // Only update status when `canEnd` and not destroyed
88+ if ( canEnd !== false && ! destroyedRef . current ) {
8789 setStatus ( STATUS_NONE ) ;
8890 setStyle ( null ) ;
8991 }
@@ -217,6 +219,7 @@ export default function useStatus(
217219 useEffect (
218220 ( ) => ( ) => {
219221 clearTimeout ( deadlineRef . current ) ;
222+ destroyedRef . current = true ;
220223 } ,
221224 [ ] ,
222225 ) ;
You can’t perform that action at this time.
0 commit comments