sylque / discpage

A Discourse plugin to create static pages and attach discussions to headings
MIT License
30 stars 5 forks source link

Post cloaking doesn't work well in split screen #6

Closed sylque closed 4 years ago

sylque commented 4 years ago

When in split screen (static page on the left, Discourse topic on the right), the cloaking mechanism doesn't work well: when there are many posts or posts are long, a post is sometimes suddenly hidden from the list.

About Discourse cloaking scheme: https://meta.discourse.org/t/increase-the-post-cloaking-threashold-or-check-first-if-media-is-playing-before-cloaking-a-post-on-scroll/43026 https://github.com/discourse/discourse/blob/c61ebc9ba67d6588c09c2b93205865e0fd388f51/app/assets/javascripts/discourse/components/scrolling-post-stream.js

sylque commented 4 years ago

Discourse cloaking algorithm fails to compute visible/invisible posts correctly when the post list has its width divided by 2. No idea why.

DiscPage v1.0.26 ships with a temporary fix: cloaking is disabled when the topic list height is divided by 2 (what it tests really is $('html.dpg.dpg-wide[data-dpg-layout="3"]').length !== 0)

sylque commented 4 years ago

The reason of the issue is this line. DiscPage inserts a .posts-wrapper block to display the static page, but Discourse expects only one such block in the html page and picks the wrong one.

sylque commented 4 years ago

The temporary fix above has issues: it prevents the navigation gauge and the read detection system to work correctly.

sylque commented 4 years ago

Fixed in 1.0.31. The .posts-wrapper block has been removed from static pages. The static page topic seems to be displayed correctly without it.