Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp committed Sep 10, 2023
1 parent 389b759 commit 00305a7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/astro/components/ViewTransitions.astro
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ const { fallback = 'animate' } = Astro.props as Props;
ev.preventDefault();
// push state on the first navigation but not if we were here already
if (location.hash) {
history.replaceState({ index: currentHistoryIndex, scrollY: -(scrollY + 1)}, '');
history.replaceState({ index: currentHistoryIndex, scrollY: -(scrollY + 1) }, '');
const newState: State = { index: ++currentHistoryIndex, scrollY: 0 };
history.pushState(newState, '', link.href);
}
Expand Down Expand Up @@ -387,7 +387,6 @@ const { fallback = 'animate' } = Astro.props as Props;
const direction: Direction = nextIndex > currentHistoryIndex ? 'forward' : 'back';
currentHistoryIndex = nextIndex;
if (state.scrollY < 0) {
console.log("restoring", state.scrollY);
scrollTo(0, -(state.scrollY + 1));
} else {
navigate(direction, new URL(location.href), state);
Expand Down

0 comments on commit 00305a7

Please sign in to comment.