Skip to content

Commit eaa7d4f

Browse files
committed
fix: remove isActive
1 parent d29e59f commit eaa7d4f

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/components/PaginatedTable/TableChunk.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ interface TableChunkProps<T, F> {
2929
columns: Column<T>[];
3030
filters?: F;
3131
sortParams?: SortParams;
32-
isActive: boolean;
3332
tableName: string;
3433

3534
fetchData: FetchData<T, F>;
@@ -56,7 +55,6 @@ export const TableChunk = typedMemo(function TableChunk<T, F>({
5655
renderErrorMessage,
5756
renderEmptyDataMessage,
5857
onDataFetched,
59-
isActive,
6058
keepCache,
6159
}: TableChunkProps<T, F>) {
6260
const [isTimeoutActive, setIsTimeoutActive] = React.useState(true);
@@ -75,7 +73,7 @@ export const TableChunk = typedMemo(function TableChunk<T, F>({
7573
};
7674

7775
tableDataApi.useFetchTableChunkQuery(queryParams, {
78-
skip: isTimeoutActive || !isActive,
76+
skip: isTimeoutActive,
7977
pollingInterval: autoRefreshInterval,
8078
refetchOnMountOrArgChange: !keepCache,
8179
});
@@ -85,7 +83,7 @@ export const TableChunk = typedMemo(function TableChunk<T, F>({
8583
React.useEffect(() => {
8684
let timeout = 0;
8785

88-
if (isActive && isTimeoutActive) {
86+
if (isTimeoutActive) {
8987
timeout = window.setTimeout(() => {
9088
setIsTimeoutActive(false);
9189
}, DEBOUNCE_TIMEOUT);
@@ -94,26 +92,22 @@ export const TableChunk = typedMemo(function TableChunk<T, F>({
9492
return () => {
9593
window.clearTimeout(timeout);
9694
};
97-
}, [isActive, isTimeoutActive]);
95+
}, [isTimeoutActive]);
9896

9997
React.useEffect(() => {
100-
if (currentData && isActive) {
98+
if (currentData) {
10199
onDataFetched({
102100
...currentData,
103101
data: currentData.data as T[],
104102
found: currentData.found || 0,
105103
total: currentData.total || 0,
106104
});
107105
}
108-
}, [currentData, isActive, onDataFetched]);
106+
}, [currentData, onDataFetched]);
109107

110108
const dataLength = currentData?.data?.length || calculatedCount;
111109

112110
const renderContent = () => {
113-
if (!isActive) {
114-
return null;
115-
}
116-
117111
if (!currentData) {
118112
if (error) {
119113
const errorData = error as IResponseError;
@@ -158,10 +152,7 @@ export const TableChunk = typedMemo(function TableChunk<T, F>({
158152
id={id.toString()}
159153
style={{
160154
height: `${dataLength * rowHeight}px`,
161-
// Default display: table-row-group doesn't work in Safari and breaks the table
162-
// display: block works in Safari, but disconnects thead and tbody cell grids
163-
// Hack to make it work in all cases
164-
display: isActive ? 'table-row-group' : 'block',
155+
display: 'table-row-group',
165156
}}
166157
>
167158
{renderContent()}

src/components/PaginatedTable/useVirtualizedTbodies.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export const useVirtualizedTbodies = <T, F>({
8989
renderErrorMessage={renderErrorMessage}
9090
renderEmptyDataMessage={renderEmptyDataMessage}
9191
onDataFetched={onDataFetched}
92-
isActive={true}
9392
keepCache={keepCache}
9493
/>,
9594
);

0 commit comments

Comments
 (0)