Skip to content

Commit d45098b

Browse files
authored
fix: Hide Header tmp when column data not ready (#406)
1 parent d98dc3a commit d45098b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Header/FixedHeader.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,14 @@ function FixedHeader<RecordType>({
4848
};
4949
}, [scrollbarSize, stickyOffsets]);
5050

51+
const cloneWidths: number[] = [];
52+
for (let i = 0; i < columCount; i += 1) {
53+
cloneWidths[i] = colWidths[i];
54+
}
55+
const columnWidthsReady = !colWidths.every(width => !width);
56+
5157
return (
52-
<table style={{ tableLayout: 'fixed' }}>
58+
<table style={{ tableLayout: 'fixed', visibility: columnWidthsReady ? null : 'hidden' }}>
5359
<ColGroup colWidths={[...colWidths, scrollbarSize]} columCount={columCount + 1} />
5460
<Header
5561
{...props}

tests/__snapshots__/Table.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ exports[`Table.Basic custom components renders fixed column and header correctly
7878
style="overflow-x: scroll; margin-bottom: -15px;"
7979
>
8080
<table
81-
style="table-layout: fixed;"
81+
style="table-layout: fixed; visibility: hidden;"
8282
>
8383
<colgroup>
8484
<col />

0 commit comments

Comments
 (0)