Skip to content

Commit eecee87

Browse files
authored
revert: fix: Prevent empty table from flickering (#542) (#563)
1 parent 4323c25 commit eecee87

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/table/use-sticky-header.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ export const useStickyHeader = (
4747
}, [theadRef, secondaryTheadRef, secondaryTableRef, tableWrapperRef, tableRef]);
4848
useLayoutEffect(() => {
4949
syncColumnHeaderWidths();
50+
// Content is not going to be layed out until the next frame in angular,
51+
// so we need to sync the column headers again.
52+
setTimeout(() => syncColumnHeaderWidths(), 0);
5053
const secondaryTable = secondaryTableRef.current;
5154
const primaryTable = tableWrapperRef.current;
5255
return () => {
@@ -57,7 +60,7 @@ export const useStickyHeader = (
5760
primaryTable.style.marginTop = '';
5861
}
5962
};
60-
}, [secondaryTableRef, tableWrapperRef, syncColumnHeaderWidths]);
63+
});
6164
useResizeObserver(theadRef, syncColumnHeaderWidths);
6265
const scrollToTop = () => {
6366
if (!isMobile && theadRef.current && secondaryTheadRef.current && tableWrapperRef.current) {

0 commit comments

Comments
 (0)