lazyloading and less comment preloading

This commit is contained in:
2026-05-17 11:46:21 +02:00
parent a7b8f8f8e5
commit 55a9548f95
2 changed files with 15 additions and 9 deletions

View File

@@ -783,8 +783,11 @@ export default (router, tpl) => {
router.get(/\/activity\/?/, async (req, res) => {
try {
const page = +(req.url.qs?.page || 1);
const limit = 50;
const offset = (page - 1) * limit;
const limit = Math.min(+(req.url.qs?.limit || 50), 50);
// Support explicit offset (used by sidebar infinite-scroll after a non-standard initial limit)
const offset = req.url.qs?.offset !== undefined
? Math.max(0, +(req.url.qs.offset))
: (page - 1) * limit;
/* <mode-override> */
// prioritize query mode (from AJAX) over session default