Skip to content

Commit

Permalink
fix: connectRouter fix (#433)
Browse files Browse the repository at this point in the history
* fix: update angular versions

* fix: connectRouter fix

---------

Co-authored-by: kim.tran <[email protected]>
Co-authored-by: Annika Nowak <[email protected]>
Co-authored-by: markuczy <[email protected]>
  • Loading branch information
4 people authored Aug 30, 2024
1 parent 4b98025 commit 06c2bdb
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,15 @@ function connectMicroFrontendRouter(injector: Injector, warn = true): Subscripti
}

function connectRouter(router: Router): Subscription {
const initialUrl = `${location.pathname.substring(getLocation().deploymentPath.length)}${location.search}`
router.navigate([initialUrl], { fragment: location.hash.substring(1) })
const initialUrl = `${location.pathname.substring(getLocation().deploymentPath.length)}${location.search}${location.hash}`
router.navigateByUrl(initialUrl)
let lastUrl = initialUrl
let lastHash = location.hash
const observer = new EventsTopic()
return observer.pipe(filter((e) => e.type === 'navigated')).subscribe(() => {
const routerUrl = `${location.pathname.substring(getLocation().deploymentPath.length)}${location.search}`
if (routerUrl !== lastUrl || location.hash !== lastHash) {
const routerUrl = `${location.pathname.substring(getLocation().deploymentPath.length)}${location.search}${location.hash}`
if (routerUrl !== lastUrl) {
lastUrl = routerUrl
lastHash = location.hash
router.navigate([routerUrl], { fragment: location.hash.substring(1) })
router.navigateByUrl(routerUrl)
}
})
}

0 comments on commit 06c2bdb

Please sign in to comment.