mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-30 21:23:45 +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]);
|
}, [id]);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
heroStatusRef.current?.scrollIntoView({
|
const hasAncestor = statuses.some((s) => s.ancestor);
|
||||||
// behavior: 'smooth',
|
if (hasAncestor) {
|
||||||
block: 'start',
|
heroStatusRef.current?.scrollIntoView({
|
||||||
});
|
// behavior: 'smooth',
|
||||||
|
block: 'start',
|
||||||
|
});
|
||||||
|
}
|
||||||
}, [statuses]);
|
}, [statuses]);
|
||||||
|
|
||||||
const heroStatus = states.statuses.get(id);
|
const heroStatus = states.statuses.get(id);
|
||||||
|
|
Loading…
Add table
Reference in a new issue