-
Notifications
You must be signed in to change notification settings - Fork 97
Closed
Labels
Description
Since updating Next.js from v14.0.1 to v14.0.2 and v14.0.3 the useResizeDetector() hook is no more working in the local development environment.
On the initial render the hook always returns undefined.
If I edit the component after it's first render and the dev server triggers a rerender, the hook returns the correct values.
This can be simulated with the following code:
export function NavigationMenuBar() {
const { height: menuBarHeight, ref: menuBarRef } = useResizeDetector();
useEffect(() => {
console.log('menuBarHeight', menuBarHeight);
document.documentElement.style.setProperty(
'--navigation-menu-bar-height',
`${Math.floor(menuBarHeight || 0)}px`,
);
}, [menuBarHeight]);
return (
<nav ref={menuBarRef}>Nav</nav>
);
}In the production build or with Next.js v14.0.1 everything is working as expected.
I know that this might be a Next.js issue, but I currently don't understand what could cause this problem - so it's difficult to me to open an issue there.
SiddharthPant, trongthienpc, brstreet2, zophiana, OscarGauss and 1 more