scroll to error only when route is focused

This commit is contained in:
nklhrstv 2020-03-28 18:01:42 +02:00
parent bd6b177f7f
commit 948ff51d3b

View file

@ -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]);