PostStream requests the next page too late, so arriving posts shove the footer off screen (CLS ~0.9 on mobile)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript
- Área
- frontend, performance
Línea de trabajo
Comienza en framework/core/js/src/forum/components/PostStream.js, en las líneas 227-241, e inspecciona PostStream#loadPostsIfNeeded(). Reproduce el escenario móvil a 412x823 con una conexión limitada y verifica después que la siguiente página se solicite antes y que las publicaciones lleguen sin hacer que el pie de página entre en el área visible; el issue también requiere una prueba de regresión.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Current Behavior
PostStream#loadPostsIfNeeded() only requests the next page of posts once the end of the loaded stream comes within a fixed 300 px of the viewport bottom:
const loadAheadDistance = 300;
...
if ($item.length && $item.offset().top + $item.outerHeight(true) < viewportTop + viewportHeight + loadAheadDistance) {
this.stream.loadNext();
}
On a phone, on a real connection, that request is still in flight when the page footer scrolls into view. The posts then arrive and shove the footer out of the viewport — one layout shift of ~0.9, which on its own rates the whole page view "poor" for CLS.
It reproduces for guests and members alike, on every discussion with more than one page of posts, so it affects a large share of mobile discussion views on any forum.
Captured from the shift entry (mobile viewport 412x823):
v=0.8967 DIV.custom-footer prev y=743 h=79 -> cur y=0 h=0
PostStream items 20 -> 40, stream height 11366 -> 18937
Desktop is essentially unaffected (measured 0.003 on the same thread) because the same footer movement is a much smaller fraction of a large viewport — which is why this tends to show up only in the mobile half of Search Console's Core Web Vitals report.
Steps to Reproduce
- Open a discussion with more than 20 posts on a phone-sized viewport (412x823), on a throttled connection (~1.6 Mbps, 150 ms latency).
- Scroll to the bottom of the first page of posts so the footer comes into view.
- Watch the footer as the next page arrives — it is pushed off screen.
Measured with a buffered PerformanceObserver on layout-shift (hadRecentInput entries excluded), scrolling with real wheel input via CDP Input.dispatchMouseEvent, headless Chrome 140, 4x CPU throttle.
Expected Behavior
The next page should be requested early enough that it arrives while the end of the stream is still below the fold, so the growth happens off screen and costs no layout shift. The same pages are fetched either way — only the timing changes.
Scaling the look-ahead with the viewport instead of using a fixed 300 px is enough:
const loadAheadDistance = Math.max(300, $(window).height() * 1.5);
Measured on an 85-post discussion read to the bottom: CLS 0.897 -> 0.018.
I have this running in production as an extension override and am happy to open a PR with a regression test if the approach looks right.
Environment
- Flarum version: 2.0.0-rc.8
- Website URL: https://pianoclack.com
- Webserver: nginx
- Hosting environment: VPS
- PHP version: 8.4.24
- Browser: Chrome 140 (mobile emulation, and reproduced on real Android Chrome field data)
- Lenguaje dominante
- PHP
- Estrellas
- 6.8k
- Forks
- 891
- Merge medio
- 1 d 10 h
- PR fusionados (30 d)
- 209
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de flarum/framework
-
type/accessibility type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Default language is ignored for anyone who chose a language, when the language selector is hiddenPosiblemente ocupada @1AbdullahButt la tomó hace 15 días. Abiertotype/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
[2.x] False CLI/Web PHP mismatch when /usr/bin/php differs from the site's FPMPosiblemente ocupada @lazerg la tomó hace 15 días. Abiertotype/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[2.x] A filter on a resource without a searcher returns a 500Posiblemente ocupada @imorland la tomó hoy. Abiertotype/bug
flarum/framework#5578 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[2.x] Audit's discussion and user filters fail on PostgreSQLPosiblemente ocupada @imorland la tomó hoy. Abiertotype/bug
flarum/framework#5577 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de flarum/framework
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 87/100
Sylius/Sylius#19359 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Add php 8.6Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 66/100
mailersend/mailersend-php#199 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Tool: somcp_delete_currencyAbiertoConfiguration new tool
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
novalo-dev/Prestashop-MCP-Server#366 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 10 días