Skip to content

Commit 8ab1f98

Browse files
committed
Clear selection when changing listing
This is so that it is not possible to perform actions on selected files once they are no longer visible.
1 parent 166d77d commit 8ab1f98

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/webapp/ui/src/eln/gallery/useGalleryListing.js

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
filenameExceptExtension,
1212
justFilenameExtension,
1313
} from "../../util/files";
14+
import { useGallerySelection } from "./useGallerySelection";
1415

1516
export opaque type Id = number;
1617
export function idToString(id: Id): string {
@@ -195,6 +196,7 @@ export function useGalleryListing({
195196
defaultPath ?? []
196197
);
197198
const [parentId, setParentId] = React.useState<Result<Id>>(Result.Error([]));
199+
const selection = useGallerySelection();
198200

199201
function emptyReason(): string {
200202
if (path.length > 0) {
@@ -261,6 +263,7 @@ export function useGalleryListing({
261263
}
262264

263265
async function getGalleryFiles(): Promise<void> {
266+
selection.clear();
264267
setGalleryListing([]);
265268
setLoading(true);
266269
try {

0 commit comments

Comments
 (0)