nextcloud / nextcloud/spreed

Unread counter vs visual unread messages marker discrepancy

Open
#5,948 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature: chat 💬
Dominant language
PHP
Stars
2.2k
Forks
587
Avg merge
18h 27m
Merged PRs (30d)
333

Description

Steps to reproduce

  1. Requires https://github.com/nextcloud/spreed/pull/5945 to be merged already
  2. Create a conversation A and have other users post a lot of messages (ex: bot or script)
  3. Go to another conversation B and then wait until conversation A has 40+ messages
  4. Stop activity in A so that no new messages are posted
  5. Go back to conversation A
  6. Scroll down more than one page but not to the bottom
  7. Wait for the left sidebar to reload (~ 30 seconds)
Expected behaviour

The number of unread messages visible in the left sidebar matches the number I see below the unread marker.

Actual behaviour

Due to the discrepancy between visual read marker and store read marker, the left sidebar will already update to a lower number than what is visible.
Note: usually the visual marker would update its position if you switch away to another window and then come back ("focus" event)

Talk app

Talk app version: 13.0.0 commit 48a06781dd6bc895f46d4967ef72ed6f7aaea813

Solutions

Keep left sidebar counter behind

After fetching the list of conversations, directly check if we have a visual marker in the current conversation and update the number of unread messages to match that.

In general: we should still update to the new value if the user switches to another conversation.

Update the visual marker upon fetch

After fetching the list of conversations, also update the marker position in the current chat.

Drawback: the reason for the visual marker position was that the user is not surprised by seeing it jump.
This solution would make it jump at an unpredictable moment and would likely make the behavior feel random and broken.

Ignore

Maybe this is not such big an issue and can be ignored.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the conversation A/B scenario with 40+ messages, then inspect the code that fetches the conversation list, maintains the visual unread marker, and updates the sidebar counter. Compare the visual marker and store read marker after scrolling and waiting for the sidebar reload. Done means the sidebar count matches the unread marker without an unexpected marker jump.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.