Skip to content

Commit 8d3aa28

Browse files
authored
Merge branch 'next' into hd/fix-astrojs-check-version-0-9-7-beta
2 parents 96e95b1 + de110ba commit 8d3aa28

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

.changeset/drop-cjs-config-support.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
'astro': major
33
---
44

5-
Dropped support for `astro.config.cjs` and `astro.config.cts`.
6-
7-
Rename your configuration file using the extensions `.mjs`, `.js`, `.ts` or `mts`.
5+
Removes support for CommonJS config files - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/#removed-support-for-commonjs-config-files))

.changeset/tangy-years-grin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fixes an issue where the `astro:page-load` event did not fire on initial page loads.

packages/astro/src/transitions/events.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { updateScrollPosition } from './router.js';
21
import { swap } from './swap-functions.js';
32
import type { Direction, NavigationTypeString } from './types.js';
43

@@ -184,6 +183,15 @@ export async function doPreparation(
184183
return event;
185184
}
186185

186+
// only update history entries that are managed by us
187+
// leave other entries alone and do not accidentally add state.
188+
export const updateScrollPosition = (positions: { scrollX: number; scrollY: number }) => {
189+
if (history.state) {
190+
history.scrollRestoration = 'manual';
191+
history.replaceState({ ...history.state, ...positions }, '');
192+
}
193+
};
194+
187195
export async function doSwap(
188196
afterPreparation: BeforeEvent,
189197
viewTransition: ViewTransition,

packages/astro/src/transitions/router.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
TRANSITION_AFTER_SWAP,
77
onPageLoad,
88
triggerEvent,
9+
updateScrollPosition,
910
} from './events.js';
1011
import { detectScriptExecuted } from './swap-functions.js';
1112
import type { Direction, Fallback, Options } from './types.js';
@@ -27,15 +28,6 @@ type Transition = {
2728

2829
const inBrowser = import.meta.env.SSR === false;
2930

30-
// only update history entries that are managed by us
31-
// leave other entries alone and do not accidentally add state.
32-
export const updateScrollPosition = (positions: { scrollX: number; scrollY: number }) => {
33-
if (history.state) {
34-
history.scrollRestoration = 'manual';
35-
history.replaceState({ ...history.state, ...positions }, '');
36-
}
37-
};
38-
3931
export const supportsViewTransitions = inBrowser && !!document.startViewTransition;
4032

4133
export const transitionEnabledOnThisPage = () =>

0 commit comments

Comments
 (0)