cthit / cthit/chalmers.it

Potential time desync when infinite scrolling

Open
#88 0 comments 0 reactions 0 assignees View on GitHub
backend bug
Dominant language
TypeScript
Stars
5
Forks
5
Avg merge
6h 45m
Merged PRs (30d)
3

Description

### 📝 Describe the bug

There is an edge case in infinite scrolling where posts could have been added or removed after the page has been loaded, potentially causing duplicate posts to show up or posts to be skipped.

### 🔄 To Reproduce

1. Start infinite scrolling at least once segment
2. Create or remove a news post (in a separate tab/window)
3. Infinite scroll another segment

### 📷 Screenshots

_No response_

### 💡 Additional context

I see two potential solutions to this:
1. **Store when the page was loaded, and filter on posts that were added afterwards**
This only mitigates the effects of creation, and not deletion
2. **Store which news post was loaded last and get posts after that for the next segment**
- If basing this off timestamps, there could be problems with duplicated or skipped posts. This could occur if two (or more) timestamps are equal, which could happen for example if two posts are scheduled for the same time.
- If basing this off post IDs, assuming IDs not ascending, there could be similar issues if the stored post ID was deleted.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.