Fix height calculation of app layout components

The height of the app bar was lost after opening and closing the reader because ref was already created but its current value changed.
However, the ResizeObserver was still observing the old element.

Updated other hook usages, which might cause the same issue, as well
This commit is contained in:
schroda
2024-07-17 22:08:31 +02:00
parent 77a7b8be4c
commit c770505021
5 changed files with 5 additions and 5 deletions

View File

@@ -87,7 +87,7 @@ export function DefaultNavBar() {
const appBarRef = useRef<HTMLDivElement | null>(null);
useResizeObserver(
appBarRef,
useCallback(() => setAppBarHeight(appBarRef.current?.clientHeight ?? 0), [appBarRef]),
useCallback(() => setAppBarHeight(appBarRef.current?.clientHeight ?? 0), [appBarRef.current]),
);
useEffect(() => setAppBarHeight(0), []);