Skip to content

Commit 0c0d55c

Browse files
committed
Use infohash as rowId
1 parent f750401 commit 0c0d55c

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

src/tribler/ui/src/components/ui/simple-table.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ interface ReactTableProps<T extends object> {
6969
maxHeight?: string | number;
7070
expandable?: boolean;
7171
storeSortingState?: string;
72+
rowId?: (originalRow: T, index: number, parent?: Row<T>) => string,
7273
}
7374

7475
function SimpleTable<T extends object>({
@@ -87,7 +88,8 @@ function SimpleTable<T extends object>({
8788
filters,
8889
maxHeight,
8990
expandable,
90-
storeSortingState
91+
storeSortingState,
92+
rowId
9193
}: ReactTableProps<T>) {
9294
const [pagination, setPagination] = useState<PaginationState>({
9395
pageIndex: pageIndex ?? 0,
@@ -137,6 +139,7 @@ function SimpleTable<T extends object>({
137139
onExpandedChange: setExpanded,
138140
onSortingChange: setSorting,
139141
getSubRows: (row: any) => row?.subRows,
142+
getRowId: rowId,
140143
});
141144

142145
const { t } = useTranslation();

src/tribler/ui/src/pages/Downloads/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ export default function Downloads({ statusFilter }: { statusFilter: number[] })
195195
onSelectedRowsChange={setSelectedDownloads}
196196
maxHeight={Math.max((parentRect?.height ?? 50) - 50, 50)}
197197
storeSortingState="download-sorting"
198+
rowId={(row) => row.infohash}
198199
/>
199200
</Card>
200201
</div>

src/tribler/ui/src/pages/Popular/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export default function Popular() {
112112
data={torrents}
113113
columns={torrentColumns}
114114
storeSortingState="popular-sorting"
115+
rowId={(row) => row.infohash}
115116
/>
116117
</>
117118
)

src/tribler/ui/src/pages/Search/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export default function Search() {
151151
data={torrents}
152152
columns={torrentColumns}
153153
storeSortingState="search-sorting"
154+
rowId={(row) => row.infohash}
154155
/>
155156
</>
156157
)

0 commit comments

Comments
 (0)