@@ -74,18 +74,17 @@ export function detachProgressivelyEnhancedNavigationListener() {
7474function performProgrammaticEnhancedNavigation ( absoluteInternalHref : string , replace : boolean ) : void {
7575 let isSelfNavigation = isForSamePath ( absoluteInternalHref , location . href ) ;
7676
77- performEnhancedPageLoad ( absoluteInternalHref , /* interceptedLink */ false ) ;
78-
79- if ( ! isSelfNavigation ) {
80- resetScrollAfterNextBatch ( ) ;
81- }
82-
83- // history update should be the last step - same as in client side routing
8477 if ( replace ) {
8578 history . replaceState ( null , /* ignored title */ '' , absoluteInternalHref ) ;
8679 } else {
8780 history . pushState ( null , /* ignored title */ '' , absoluteInternalHref ) ;
8881 }
82+
83+ if ( ! isSelfNavigation ) {
84+ resetScrollAfterNextBatch ( ) ;
85+ }
86+
87+ performEnhancedPageLoad ( absoluteInternalHref , /* interceptedLink */ false ) ;
8988}
9089
9190function getCurrentScrollPosition ( ) {
@@ -119,11 +118,9 @@ function onDocumentClick(event: MouseEvent) {
119118 performScrollToElementOnTheSamePage ( absoluteInternalHref ) ;
120119 } else {
121120 let isSelfNavigation = isForSamePath ( absoluteInternalHref , location . href ) ;
122- if ( ! isSelfNavigation ) {
123- resetScrollAfterNextBatch ( ) ;
124- }
125121 performEnhancedPageLoad ( absoluteInternalHref , /* interceptedLink */ true ) ;
126122 if ( ! isSelfNavigation ) {
123+ resetScrollAfterNextBatch ( ) ;
127124 resetScrollIfNeeded ( ) ;
128125 }
129126 }
0 commit comments