router fix

This commit is contained in:
bniwredyc 2023-03-29 19:02:31 +02:00
parent f73456cea5
commit 5102b502b1
2 changed files with 10 additions and 5 deletions

View File

@ -270,7 +270,7 @@ export const FullArticle = (props: ArticleProps) => {
)}
</For>
</div>
<div ref={commentsRef}>
<div>
<Show when={isReactionsLoaded()}>
<CommentsTree
shoutId={props.article.id}

View File

@ -57,6 +57,15 @@ const handleClientRouteLinkClick = (event) => {
if (url.origin === location.origin) {
event.preventDefault()
if (url.pathname) {
routerStore.open(url.pathname)
}
if (url.search) {
const params = Object.fromEntries(new URLSearchParams(url.search))
searchParamsStore.open(params)
}
if (url.hash) {
let selector = url.hash
@ -79,10 +88,6 @@ const handleClientRouteLinkClick = (event) => {
return
}
routerStore.open(url.pathname)
const params = Object.fromEntries(new URLSearchParams(url.search))
searchParamsStore.open(params)
window.scrollTo({
top: 0,
left: 0