Skip to content

Commit

Permalink
fix(feed): fix dementia
Browse files Browse the repository at this point in the history
  • Loading branch information
mrilyew committed Dec 8, 2024
1 parent 35bfe97 commit 9d75f0b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Web/Presenters/templates/Wall/Feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>

<div class='scroll_container'>
<div class='scroll_node' n:foreach='$posts as $post'>
<div class='scroll_node' n:foreach='$posts as $post' data-uniqueid="{$post->getPrettyId()}">
<a name="postGarter={$post->getId()}"></a>
{include "../components/post.xml", post => $post, onWallOf => true, commentSection => true}
</div>
Expand Down
2 changes: 1 addition & 1 deletion Web/Presenters/templates/components/wall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<div class="content scroll_container">
{if sizeof($posts) > 0}
<div class='scroll_node' n:foreach='$posts as $post'>
<div class='scroll_node' n:foreach='$posts as $post' data-uniqueid="{$post->getPrettyId()}">
<a name="postGarter={$post->getId()}"></a>

{include "../components/post.xml", post => $post, commentSection => true}
Expand Down
17 changes: 16 additions & 1 deletion Web/static/js/al_wall.js
Original file line number Diff line number Diff line change
Expand Up @@ -2335,6 +2335,15 @@ async function __processPaginatorNextPage(page)

const nodes = parsed_content.querySelectorAll(container_node)
nodes.forEach(node => {
const unique_id = node.dataset.uniqueid
if(unique_id) {
const elements_unique = u(`.scroll_node[data-uniqueid='${unique_id}']`).length
if(elements_unique > 0) {
console.info('AJAX | Found duplicates')
return
}
}

container.append(node)
})

Expand Down Expand Up @@ -2395,7 +2404,13 @@ const showMoreObserver = new IntersectionObserver(entries => {
}

const page_number = Number(next_page.html())
await __processPaginatorNextPage(page_number)

try {
await __processPaginatorNextPage(page_number)
} catch(e) {
console.error(e)
}

bsdnHydrate()
u('.paginator:not(.paginator-at-top)').removeClass('lagged')
}
Expand Down

0 comments on commit 9d75f0b

Please sign in to comment.