mirror of
https://github.com/outline/outline.git
synced 2026-11-27 16:08:58 +03:00
fix: useComponentSize should run in useLayoutEffect
This commit is contained in:
1 parent
676e89a58e
commit
ce51fa9957
1 file changed
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { useState, useLayoutEffect, useEffect } from "react";
|
||||
import { useState, useLayoutEffect } from "react";
|
||||
|
||||
const defaultRect = {
|
||||
top: 0,
|
||||
@@ -33,7 +33,7 @@ export function useComponentSize(
|
||||
return () => sizeObserver.disconnect();
|
||||
}, [element]);
|
||||
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => {
|
||||
const handleResize = () => {
|
||||
setSize((state) => {
|
||||
const rect = element?.getBoundingClientRect();
|
||||
|
||||
Reference in new issue
Block a user