Skip to content

Commit

Permalink
Revert "Render table in chunks"
Browse files Browse the repository at this point in the history
This reverts commit cdfcd84.
  • Loading branch information
ArtemBaskal committed Jun 17, 2020
1 parent cdfcd84 commit 5820c92
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
21 changes: 4 additions & 17 deletions client/src/components/Logs/Table.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { useTranslation, Trans } from 'react-i18next';
import ReactTable from 'react-table';
Expand All @@ -12,7 +12,7 @@ import {
FILTERED_STATUS_TO_META_MAP,
TABLE_DEFAULT_PAGE_SIZE,
TRANSITION_TIMEOUT,
SCHEME_TO_PROTOCOL_MAP, TABLE_CHUNK_RENDER_INTERVAL,
SCHEME_TO_PROTOCOL_MAP,
} from '../../helpers/constants';
import getDateCell from './Cells/getDateCell';
import getDomainCell from './Cells/getDomainCell';
Expand Down Expand Up @@ -196,32 +196,19 @@ const Table = (props) => {
}
};

const [tableSize, setTableSize] = useState(TABLE_DEFAULT_PAGE_SIZE / 4);

const changePage = (page) => {
setIsLoading(true);
setLogsPage(page);
setLogsPagination({
page,
pageSize: TABLE_DEFAULT_PAGE_SIZE,
});
setTableSize(TABLE_DEFAULT_PAGE_SIZE / 4);
};

const tableClass = classNames('logs__table', {
'logs__table--detailed': isDetailed,
});

useEffect(() => {
const intervalId = setInterval(() => setTableSize((tableSize) => {
if (tableSize < TABLE_DEFAULT_PAGE_SIZE) {
return tableSize + TABLE_DEFAULT_PAGE_SIZE / 4;
}
return TABLE_DEFAULT_PAGE_SIZE;
}), TABLE_CHUNK_RENDER_INTERVAL);

return () => clearInterval(intervalId);
}, [TABLE_DEFAULT_PAGE_SIZE]);

return (
<ReactTable
manual
Expand All @@ -232,7 +219,7 @@ const Table = (props) => {
filterable={false}
sortable={false}
resizable={false}
data={logs.slice(0, tableSize) || []}
data={logs || []}
loading={isLoading}
showPageJump={false}
showPageSizeOptions={false}
Expand Down
2 changes: 0 additions & 2 deletions client/src/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,6 @@ export const TABLE_FIRST_PAGE = 0;

export const LEASES_TABLE_DEFAULT_PAGE_SIZE = 20;

export const TABLE_CHUNK_RENDER_INTERVAL = 250;

export const FILTERED_STATUS = {
FILTERED_BLACK_LIST: 'FilteredBlackList',
NOT_FILTERED_WHITE_LIST: 'NotFilteredWhiteList',
Expand Down

0 comments on commit 5820c92

Please sign in to comment.