Skip to content

Commit 31f3e4d

Browse files
committed
fix(renterd): files directory mode page select ignores parent dir
1 parent a9cfe40 commit 31f3e4d

File tree

4 files changed

+37
-10
lines changed

4 files changed

+37
-10
lines changed

.changeset/polite-doors-do.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'renterd': patch
3+
---
4+
5+
Fixed an issue where selecting the entire page of files would select the parent navigation row.

apps/renterd-e2e/src/specs/files.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,24 @@ test('bulk delete using the all files explorer mode', async ({ page }) => {
338338
},
339339
})
340340
})
341+
342+
test('bulk selecting the entire page ignores the .. parent directory nav row', async ({
343+
page,
344+
}) => {
345+
const bucketName = 'bucket1'
346+
await navigateToBuckets({ page })
347+
await createBucket(page, bucketName)
348+
await createFilesMap(page, bucketName, {
349+
'file1.txt': null,
350+
'file2.txt': null,
351+
'file3.txt': null,
352+
'file4.txt': null,
353+
'file5.txt': null,
354+
})
355+
await navigateToBuckets({ page })
356+
await openBucket(page, bucketName)
357+
358+
await page.getByRole('checkbox', { name: 'select all files' }).check()
359+
const menu = page.getByLabel('file multi-select menu')
360+
await expect(menu.getByText('5 files selected')).toBeVisible()
361+
})

apps/renterd/contexts/filesDirectory/columns.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const columns: FilesTableColumn[] = [
3636
return (
3737
<ControlGroup className="flex h-4">
3838
<Checkbox
39+
aria-label="select all files"
3940
onClick={multiSelect.onSelectPage}
4041
checked={multiSelect.isPageAllSelected}
4142
/>

apps/renterd/contexts/filesDirectory/index.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ function useFilesDirectoryMain() {
2727

2828
const { limit, marker, isMore, response, refresh, dataset } = useDataset()
2929

30+
const multiSelect = useMultiSelect(dataset)
31+
32+
// If the active bucket changes, clear the multi-select.
33+
useEffect(() => {
34+
if (activeBucket) {
35+
multiSelect.deselectAll()
36+
}
37+
// eslint-disable-next-line react-hooks/exhaustive-deps
38+
}, [activeBucket])
39+
3040
// Add parent directory to the dataset.
3141
const _datasetPage = useMemo(() => {
3242
if (!dataset) {
@@ -55,16 +65,6 @@ function useFilesDirectoryMain() {
5565
// eslint-disable-next-line react-hooks/exhaustive-deps
5666
}, [dataset])
5767

58-
const multiSelect = useMultiSelect(_datasetPage)
59-
60-
// If the active bucket changes, clear the multi-select.
61-
useEffect(() => {
62-
if (activeBucket) {
63-
multiSelect.deselectAll()
64-
}
65-
// eslint-disable-next-line react-hooks/exhaustive-deps
66-
}, [activeBucket])
67-
6868
const {
6969
onDragEnd,
7070
onDragOver,

0 commit comments

Comments
 (0)