Skip to content

Commit 2f03503

Browse files
authored
Fix anchor links on initial visits (#2258)
* Fix anchor links on initial visits * Update changelog
1 parent fc8e1d4 commit 2f03503

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For changes prior to v1.0.0, see the [legacy releases](https://legacy.inertiajs.
99

1010
## [Unreleased](https://github.com/inertiajs/inertia/compare/v2.0.3...HEAD)
1111

12-
- Nothing yet
12+
- Fix anchor links on initial visits ([#2258](https://github.com/inertiajs/inertia/pull/2258))
1313

1414
## [v2.0.3](https://github.com/inertiajs/inertia/compare/v2.0.2...v2.0.3)
1515

packages/core/src/initialVisit.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ export class InitialVisit {
9393
}
9494

9595
currentPage.set(currentPage.get(), { preserveScroll: true, preserveState: true }).then(() => {
96-
Scroll.restore(history.getScrollRegions())
96+
if (navigationType.isReload()) {
97+
Scroll.restore(history.getScrollRegions())
98+
}
9799
fireNavigateEvent(currentPage.get())
98100
})
99101
}

0 commit comments

Comments
 (0)