Skip to content

Commit ad3d78a

Browse files
committed
fix: potential fix for blur updating state after unmount
1 parent c97fa86 commit ad3d78a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

client/components/Menubar/Menubar.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,10 @@ function Menubar({ children, className }) {
154154

155155
if (!isInMenu) {
156156
timerRef.current = setTimeout(() => {
157-
setMenuOpen('none');
158-
setHasFocus(false);
157+
if (nodeRef.current) {
158+
setMenuOpen('none');
159+
setHasFocus(false);
160+
}
159161
}, 10);
160162
}
161163
},
@@ -213,6 +215,10 @@ function Menubar({ children, className }) {
213215
}
214216
}, [activeIndex, prevIndex, menuItems]);
215217

218+
useEffect(() => {
219+
clearHideTimeout();
220+
}, [clearHideTimeout]);
221+
216222
// context value for dropdowns and menu items
217223
const contextValue = useMemo(
218224
() => ({

0 commit comments

Comments
 (0)