This commit is contained in:
parent
08ce0cf5aa
commit
e3b6528027
@ -142,14 +142,14 @@ export default function PlayerScores({ initialScoreData, initialSearch, player,
|
|||||||
* scores when new scores are loaded.
|
* scores when new scores are loaded.
|
||||||
*/
|
*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (topOfScoresRef.current) {
|
if (topOfScoresRef.current && shouldFetch) {
|
||||||
const topOfScoresPosition = (topOfScoresRef.current as any).getBoundingClientRect().top + window.scrollY;
|
const topOfScoresPosition = (topOfScoresRef.current as any).getBoundingClientRect().top + window.scrollY;
|
||||||
window.scrollTo({
|
window.scrollTo({
|
||||||
top: topOfScoresPosition - 55, // Navbar height (plus some padding)
|
top: topOfScoresPosition - 55, // Navbar height (plus some padding)
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [pageState, topOfScoresRef]);
|
}, [pageState, topOfScoresRef, shouldFetch]);
|
||||||
|
|
||||||
const invalidSearch = searchTerm.length >= 1 && searchTerm.length < 3;
|
const invalidSearch = searchTerm.length >= 1 && searchTerm.length < 3;
|
||||||
return (
|
return (
|
||||||
|
Reference in New Issue
Block a user