From 6ab463285d566c18ef0b4034fbfd0b5863a4f7a5 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Thu, 30 Jan 2025 11:22:23 +0100 Subject: [PATCH] fix(setup): resolve looping library validation error message (#1316) This PR fixes a bug where the validation error message is displayed over and over because of a React useEffect dependency issue. Previously, the `validateLibraries()` function was being called inside a useEffect that depended on a state that this function was updating. --- src/components/Setup/index.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/Setup/index.tsx b/src/components/Setup/index.tsx index 8a747c6f1..8a3d9e664 100644 --- a/src/components/Setup/index.tsx +++ b/src/components/Setup/index.tsx @@ -133,10 +133,6 @@ const Setup = () => { setCurrentStep(3); } } - - if (currentStep === 3) { - validateLibraries(); - } }, [ settings.currentSettings.mediaServerType, settings.currentSettings.initialized, @@ -148,6 +144,13 @@ const Setup = () => { validateLibraries, ]); + useEffect(() => { + if (currentStep === 3) { + validateLibraries(); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [currentStep]); + const handleComplete = () => { validateLibraries(); };