1
0
Fork 0

Only snap to top when there are ancestors

This commit is contained in:
Lim Chee Aun 2022-12-18 13:43:34 +08:00
parent 762e525c68
commit 9eb40d165f

View file

@ -94,10 +94,13 @@ function StatusPage({ id }) {
}, [id]);
useLayoutEffect(() => {
heroStatusRef.current?.scrollIntoView({
// behavior: 'smooth',
block: 'start',
});
const hasAncestor = statuses.some((s) => s.ancestor);
if (hasAncestor) {
heroStatusRef.current?.scrollIntoView({
// behavior: 'smooth',
block: 'start',
});
}
}, [statuses]);
const heroStatus = states.statuses.get(id);