0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
matthewp 2023-07-28 13:09:24 +00:00 committed by astrobot-houston
parent 49a4b28202
commit 2f95a3e0ca
2 changed files with 16 additions and 12 deletions

View file

@ -41,11 +41,11 @@ const { fallback = 'animate' } = Astro.props as Props;
if (wait) return;
cb(...args);
wait = true
wait = true;
setTimeout(() => {
wait = false
wait = false;
}, delay);
}
};
};
async function getHTML(href: string) {
@ -89,7 +89,7 @@ const { fallback = 'animate' } = Astro.props as Props;
const swap = () => {
document.documentElement.replaceWith(doc.documentElement);
if(state?.scrollY != null) {
if (state?.scrollY != null) {
scrollTo(0, state.scrollY);
}
@ -237,10 +237,14 @@ const { fallback = 'animate' } = Astro.props as Props;
addEventListener('load', onload);
// There's not a good way to record scroll position before a back button.
// So the way we do it is by listening to scroll and just continuously recording it.
addEventListener('scroll', throttle(() => {
if(history.state) {
persistState({ ...history.state, scrollY })
addEventListener(
'scroll',
throttle(() => {
if (history.state) {
persistState({ ...history.state, scrollY });
}
}, 300), { passive: true });
}, 300),
{ passive: true }
);
}
</script>

View file

@ -235,7 +235,7 @@ test.describe('View Transitions', () => {
const newScrollY = await page.evaluate(() => window.scrollY);
expect(oldScrollY).toEqual(newScrollY);
})
});
test('<Image /> component forwards transitions to the <img>', async ({ page, astro }) => {
// Go to page 1