Skip to content

Commit

Permalink
Use infohash as rowId
Browse files Browse the repository at this point in the history
egbertbouman committed Dec 4, 2024
1 parent f750401 commit 0c0d55c
Showing 4 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tribler/ui/src/components/ui/simple-table.tsx
Original file line number Diff line number Diff line change
@@ -69,6 +69,7 @@ interface ReactTableProps<T extends object> {
maxHeight?: string | number;
expandable?: boolean;
storeSortingState?: string;
rowId?: (originalRow: T, index: number, parent?: Row<T>) => string,
}

function SimpleTable<T extends object>({
@@ -87,7 +88,8 @@ function SimpleTable<T extends object>({
filters,
maxHeight,
expandable,
storeSortingState
storeSortingState,
rowId
}: ReactTableProps<T>) {
const [pagination, setPagination] = useState<PaginationState>({
pageIndex: pageIndex ?? 0,
@@ -137,6 +139,7 @@ function SimpleTable<T extends object>({
onExpandedChange: setExpanded,
onSortingChange: setSorting,
getSubRows: (row: any) => row?.subRows,
getRowId: rowId,
});

const { t } = useTranslation();
1 change: 1 addition & 0 deletions src/tribler/ui/src/pages/Downloads/index.tsx
Original file line number Diff line number Diff line change
@@ -195,6 +195,7 @@ export default function Downloads({ statusFilter }: { statusFilter: number[] })
onSelectedRowsChange={setSelectedDownloads}
maxHeight={Math.max((parentRect?.height ?? 50) - 50, 50)}
storeSortingState="download-sorting"
rowId={(row) => row.infohash}
/>
</Card>
</div>
1 change: 1 addition & 0 deletions src/tribler/ui/src/pages/Popular/index.tsx
Original file line number Diff line number Diff line change
@@ -112,6 +112,7 @@ export default function Popular() {
data={torrents}
columns={torrentColumns}
storeSortingState="popular-sorting"
rowId={(row) => row.infohash}
/>
</>
)
1 change: 1 addition & 0 deletions src/tribler/ui/src/pages/Search/index.tsx
Original file line number Diff line number Diff line change
@@ -151,6 +151,7 @@ export default function Search() {
data={torrents}
columns={torrentColumns}
storeSortingState="search-sorting"
rowId={(row) => row.infohash}
/>
</>
)

0 comments on commit 0c0d55c

Please sign in to comment.