From 639dcf0f07043c92d1d422f4a93ca7b2789214a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cboz=E2=80=9D?= Date: Tue, 22 Mar 2022 15:41:47 +0800 Subject: [PATCH] fix switching page causes setting to crash --- ui/src/Pages/SettingsPage/ScannerConcurrentWorkers.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/Pages/SettingsPage/ScannerConcurrentWorkers.tsx b/ui/src/Pages/SettingsPage/ScannerConcurrentWorkers.tsx index 01e8d477..717d1603 100644 --- a/ui/src/Pages/SettingsPage/ScannerConcurrentWorkers.tsx +++ b/ui/src/Pages/SettingsPage/ScannerConcurrentWorkers.tsx @@ -26,6 +26,9 @@ const SET_CONCURRENT_WORKERS_MUTATION = gql` const ScannerConcurrentWorkers = () => { const { t } = useTranslation() + const workerAmountServerValue = useRef(null) + const [workerAmount, setWorkerAmount] = useState(0) + const workerAmountQuery = useQuery( CONCURRENT_WORKERS_QUERY, { @@ -41,9 +44,6 @@ const ScannerConcurrentWorkers = () => { setConcurrentWorkersVariables >(SET_CONCURRENT_WORKERS_MUTATION) - const workerAmountServerValue = useRef(null) - const [workerAmount, setWorkerAmount] = useState(0) - const updateWorkerAmount = (workerAmount: number) => { if (workerAmountServerValue.current != workerAmount) { workerAmountServerValue.current = workerAmount