1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-08 01:15:49 +02:00

fix archive row virtualization

This commit is contained in:
Tymoteusz Czech 2022-06-14 09:16:27 +02:00
parent de8119961f
commit fdac3a6eaf

View File

@ -33,7 +33,6 @@ import { useSearch } from 'hooks/useSearch';
import { FeatureArchivedCell } from './FeatureArchivedCell/FeatureArchivedCell'; import { FeatureArchivedCell } from './FeatureArchivedCell/FeatureArchivedCell';
import { useVirtualizedRange } from 'hooks/useVirtualizedRange'; import { useVirtualizedRange } from 'hooks/useVirtualizedRange';
import { useSearchParams } from 'react-router-dom'; import { useSearchParams } from 'react-router-dom';
import { useWindowVirtualizer } from '@tanstack/react-virtual';
export interface IFeaturesArchiveTableProps { export interface IFeaturesArchiveTableProps {
archivedFeatures: FeatureSchema[]; archivedFeatures: FeatureSchema[];
@ -69,7 +68,8 @@ export const ArchiveTable = ({
searchParams.get('search') || '' searchParams.get('search') || ''
); );
const onRevive = useCallback(async (feature: string) => { const onRevive = useCallback(
async (feature: string) => {
try { try {
await reviveFeature(feature); await reviveFeature(feature);
await refetch(); await refetch();
@ -81,7 +81,9 @@ export const ArchiveTable = ({
} catch (e: unknown) { } catch (e: unknown) {
setToastApiError(formatUnknownError(e)); setToastApiError(formatUnknownError(e));
} }
}, []); },
[refetch, reviveFeature, setToastApiError, setToastData]
);
const columns = useMemo( const columns = useMemo(
() => [ () => [
@ -135,7 +137,7 @@ export const ArchiveTable = ({
searchable: true, searchable: true,
maxWidth: 150, maxWidth: 150,
Cell: ({ value }: any) => ( Cell: ({ value }: any) => (
<LinkCell title={value} to={`/projects/${value}}`} /> <LinkCell title={value} to={`/projects/${value}`} />
), ),
}, },
{ {
@ -278,7 +280,15 @@ export const ArchiveTable = ({
<SearchHighlightProvider <SearchHighlightProvider
value={getSearchText(searchValue)} value={getSearchText(searchValue)}
> >
<Table {...getTableProps()} rowHeight={rowHeight}> <Table
{...getTableProps()}
rowHeight={rowHeight}
style={{
height:
rowHeight * rows.length +
theme.shape.tableRowHeightCompact,
}}
>
<SortableTableHeader <SortableTableHeader
headerGroups={headerGroups as any} headerGroups={headerGroups as any}
/> />
@ -297,6 +307,14 @@ export const ArchiveTable = ({
<TableRow <TableRow
hover hover
{...row.getRowProps()} {...row.getRowProps()}
style={{
display: 'flex',
top:
index * rowHeight +
theme.shape
.tableRowHeightCompact,
}}
className={classes.row}
> >
{row.cells.map(cell => ( {row.cells.map(cell => (
<TableCell <TableCell