mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
[ci] format
This commit is contained in:
parent
f66053a1ea
commit
5c23bf1c90
2 changed files with 6 additions and 11 deletions
|
@ -201,11 +201,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
||||||
scrollTo(0, state.scrollY); // usings default scrollBehavior
|
scrollTo(0, state.scrollY); // usings default scrollBehavior
|
||||||
}
|
}
|
||||||
!state &&
|
!state &&
|
||||||
history.pushState(
|
history.pushState({ index: ++currentHistoryIndex, scrollY: initialScrollY }, '', loc.href);
|
||||||
{ index: ++currentHistoryIndex, scrollY: initialScrollY },
|
|
||||||
'',
|
|
||||||
loc.href
|
|
||||||
);
|
|
||||||
triggerEvent('astro:after-swap');
|
triggerEvent('astro:after-swap');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -413,7 +409,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
||||||
// So the way we do it is by listening to scrollend if supported, and if not continuously record the scroll position.
|
// So the way we do it is by listening to scrollend if supported, and if not continuously record the scroll position.
|
||||||
const updateState = () => {
|
const updateState = () => {
|
||||||
persistState({ ...history.state, scrollY });
|
persistState({ ...history.state, scrollY });
|
||||||
}
|
};
|
||||||
|
|
||||||
if ('onscrollend' in window) addEventListener('scrollend', updateState);
|
if ('onscrollend' in window) addEventListener('scrollend', updateState);
|
||||||
else addEventListener('scroll', throttle(updateState, 300));
|
else addEventListener('scroll', throttle(updateState, 300));
|
||||||
|
|
|
@ -544,4 +544,3 @@ test.describe('View Transitions', () => {
|
||||||
await expect(p, 'should have content').toHaveText('Page 1');
|
await expect(p, 'should have content').toHaveText('Page 1');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue