From 513b746fc3ff285f617389483401cb99c05c3359 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 10 Apr 2023 22:54:05 -0700 Subject: [PATCH] Fixed: Series selection unselecting on mobile browsers Closes #5539 --- .../src/Series/Index/Select/SeriesIndexSelectFooter.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/Series/Index/Select/SeriesIndexSelectFooter.tsx b/frontend/src/Series/Index/Select/SeriesIndexSelectFooter.tsx index 63bfbe5ec..ae9197d2f 100644 --- a/frontend/src/Series/Index/Select/SeriesIndexSelectFooter.tsx +++ b/frontend/src/Series/Index/Select/SeriesIndexSelectFooter.tsx @@ -6,6 +6,7 @@ import AppState from 'App/State/AppState'; import { RENAME_SERIES } from 'Commands/commandNames'; import SpinnerButton from 'Components/Link/SpinnerButton'; import PageContentFooter from 'Components/Page/PageContentFooter'; +import usePrevious from 'Helpers/Hooks/usePrevious'; import { kinds } from 'Helpers/Props'; import { fetchRootFolders } from 'Store/Actions/rootFolderActions'; import { @@ -53,6 +54,7 @@ function SeriesIndexSelectFooter() { const [isSavingSeries, setIsSavingSeries] = useState(false); const [isSavingTags, setIsSavingTags] = useState(false); const [isSavingMonitoring, setIsSavingMonitoring] = useState(false); + const previousIsDeleting = usePrevious(isDeleting); const [selectState, selectDispatch] = useSelect(); const { selectedState } = selectState; @@ -158,10 +160,11 @@ function SeriesIndexSelectFooter() { }, [isSaving]); useEffect(() => { - if (!isDeleting && !deleteError) { + if (previousIsDeleting && !isDeleting && !deleteError) { + selectDispatch({ type: 'unselectAll' }); } - }, [isDeleting, deleteError, selectDispatch]); + }, [previousIsDeleting, isDeleting, deleteError, selectDispatch]); useEffect(() => { dispatch(fetchRootFolders());