Skip to content

Commit 95d8564

Browse files
committed
fix: remove the th setTimeout
1 parent daeaaa4 commit 95d8564

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/view/table/th.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,16 @@ export function TH(
2323
const { dispatch } = useStore();
2424

2525
useEffect(() => {
26-
setTimeout(() => {
27-
// sets the `top` style if the current TH is fixed
28-
if (config.fixedHeader && thRef.current) {
29-
const offsetTop = thRef.current.offsetTop;
26+
// sets the `top` style if the current TH is fixed
27+
if (config.fixedHeader && thRef.current) {
28+
const offsetTop = thRef.current.offsetTop;
3029

31-
if (typeof offsetTop === 'number') {
32-
setStyle({
33-
top: offsetTop,
34-
});
35-
}
30+
if (typeof offsetTop === 'number') {
31+
setStyle({
32+
top: offsetTop,
33+
});
3634
}
37-
}, 0);
35+
}
3836
}, [thRef]);
3937

4038
const isSortable = (): boolean => props.column.sort != undefined;

0 commit comments

Comments
 (0)