mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-21 16:55:25 +03:00
Only snap to top when there are ancestors
This commit is contained in:
parent
762e525c68
commit
9eb40d165f
1 changed files with 7 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue