Merge pull request 'fix status index approxmiation in timeline rendering for dynamically changing viewport geometries' (#3543) from iamtakingiteasy/pleroma-fe:fix-timeline-rendering-status-index-approx into develop

Reviewed-on: https://git.pleroma.social/pleroma/pleroma-fe/pulls/3543
This commit is contained in:
HJ 2026-08-10 13:50:37 +00:00
commit 9e4592df59
2 changed files with 5 additions and 1 deletions

View file

@ -0,0 +1 @@
Fixed status index approxmiation in timeline rendering for dynamically changing viewport geometries

View file

@ -263,7 +263,10 @@ const Timeline = {
// Start from approximating the index of some visible status by using the
// the center of the screen on the timeline.
let approxIndex = Math.floor(statuses.length * (centerOfScreen / height))
let approxIndex = Math.min(
Math.floor(statuses.length * (centerOfScreen / height)),
statuses.length - 1,
)
let err = statuses[approxIndex].getBoundingClientRect().y
// if we have a previous scroll index that can be used, test if it's