Merge branch 'router-fix' into 'dev'

router fix

See merge request discoursio/discoursio-webapp!46
This commit is contained in:
ilia tapazukk 2023-03-30 09:50:59 +00:00
commit 89cd0f4791
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