From 948ff51d3b80e18dfd60a30452937e66635d412e Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Sat, 28 Mar 2020 18:01:42 +0200 Subject: [PATCH] scroll to error only when route is focused --- src/routes/Intro/Intro.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/Intro/Intro.js b/src/routes/Intro/Intro.js index 7b3a3a71c..2758ba02e 100644 --- a/src/routes/Intro/Intro.js +++ b/src/routes/Intro/Intro.js @@ -238,7 +238,7 @@ const Intro = ({ queryParams }) => { } }, [queryParams]); React.useEffect(() => { - if (typeof state.error === 'string' && state.error.length > 0) { + if (routeFocused && typeof state.error === 'string' && state.error.length > 0) { errorRef.current.scrollIntoView(); } }, [state.error]);