Skip to content

feat(investigations): Show viewers on the investigation page - #126116

Merged
wedamija merged 2 commits into
masterfrom
danf/investigations-viewers-ui
Oct 1, 2026
Merged

wedamija merged 2 commits into
masterfrom
danf/investigations-viewers-ui

Conversation

@wedamija

Copy link
Copy Markdown
Member

Show who else has opened an investigation next to "Last update": people viewing it now first, with a green ring, then earlier viewers, faded. The list comes from the presence heartbeat, at the interval the backend returns.

@wedamija
wedamija requested a review from a team as a code owner September 30, 2026 22:52
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Sep 30, 2026
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Story previews

Preview the stories changed in this PR on the Vercel deployment:

Preview deployment: https://sentry-7or0dspvs.sentry.dev

Base automatically changed from danf/investigations-viewers-endpoint to master September 30, 2026 23:45
@wedamija
wedamija requested review from a team as code owners September 30, 2026 23:45
Show who else has opened an investigation next to "Last update": people viewing
it now first, with a green ring, then earlier viewers, faded. The list comes
from the presence heartbeat, at the interval the backend returns.
Comment on lines +86 to +88
{total > viewers.length ? (
<Text variant="muted" size="sm">
+{total - viewers.length}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The viewer overflow count +N is calculated using viewers.length instead of shown.length, leading to an inaccurate count when some viewers are no longer organization members.
Severity: LOW

Suggested Fix

The overflow count calculation should be changed from total - viewers.length to total - shown.length to accurately reflect the number of hidden viewers.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/views/investigations/detail/presence.tsx#L86-L88

Potential issue: The overflow count for viewers is calculated as `total -
viewers.length`. However, the number of avatars actually rendered is based on
`shown.length`. If a viewer has left the organization, their `userId` won't resolve to a
member, causing `shown.length` to be less than `viewers.length`. This results in the
`+N` overflow count underestimating the number of hidden viewers, making the total count
implied by the UI incorrect.

Did we get this right? 👍 / 👎 to inform future reviews.

@wedamija
wedamija merged commit 314de68 into master Oct 1, 2026
73 checks passed
@wedamija
wedamija deleted the danf/investigations-viewers-ui branch October 1, 2026 17:19

This branch was successfully deployed

1 active deployment
Preview — f2ef35cc Deployed Sep 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants