File tree Expand file tree Collapse file tree
packages/astro/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' astro ' : patch
3+ ---
4+
5+ On back navigation only animate view transitions that were animated going forward.
Original file line number Diff line number Diff line change @@ -306,10 +306,11 @@ const { fallback = 'animate' } = Astro.props as Props;
306306 return;
307307 }
308308
309- // hash change creates no state.
309+ // History entries without state are created by the browser (e.g. for hash links)
310+ // Our view transition entries always have state.
311+ // Just ignore stateless entries.
312+ // The browser will handle navigation fine without our help
310313 if (ev.state === null) {
311- persistState({ index: currentHistoryIndex, scrollY });
312- ev.preventDefault();
313314 return;
314315 }
315316
@@ -344,6 +345,8 @@ const { fallback = 'animate' } = Astro.props as Props;
344345 addEventListener(
345346 'scroll',
346347 throttle(() => {
348+ // only updste history entries that are managed by us
349+ // leave other entries alone and do not accidently add state.
347350 if (history.state) {
348351 persistState({ ...history.state, scrollY });
349352 }
You can’t perform that action at this time.
0 commit comments