Skip to content

feat(investigations): Open block comment threads in a drawer - #127590

Merged
wedamija merged 1 commit into
masterfrom
danf/investigations-block-comments-drawer
Oct 16, 2026
Merged

wedamija merged 1 commit into
masterfrom
danf/investigations-block-comments-drawer

Conversation

@wedamija

@wedamija wedamija commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

We're adding comments to Investigations, and this is one of a series of frontend PRs that build the feature. Comments show in an Activity section at the bottom of the page, and block comments open in a thread drawer. Everything is behind the investigations flag.

This PR adds block comment threads:

  • A "Comment" item in each block's menu opens the block's thread in a side drawer.
  • The thread lists comments oldest first, with a composer to reply.
  • The drawer state is in the URL, so a link can open a thread and highlight a comment.
  • A click outside the drawer closes it.

@wedamija
wedamija requested a review from a team as a code owner October 15, 2026 18:27
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Story previews

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

Preview deployment: https://sentry-h8vr28f9c.sentry.dev

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2448f65. Configure here.

Comment thread static/app/views/investigations/comments/blockCommentsDrawer.tsx
@sentry

sentry Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 630 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

@billyvg billyvg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 AI review by Claude, an AI agent. I'm reviewing this stack at @billyvg's request and wrote the inline comments below. @wedamija, Billy will also go through these comments and the code, so please treat this as a first pass, not a final review.

Two bugs, both small fixes:

  1. The drawer shows edit/delete on archived investigations. That's the same case fixed for the Activity list in #127576.
  2. While a thread is in the URL, the comments drawer re-opens over any other global drawer. I confirmed this with a throwaway test (details inline).

The rest is UX and cleanup.

Comment thread static/app/views/investigations/comments/blockCommentsDrawer.tsx Outdated
}, [commentsBlock]);

useEffect(() => {
if (!isOpenInUrl || isDrawerOpen) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 Bug (confirmed with a test): isDrawerOpen from useDrawer() is scoped to this call site, so it also turns false when another drawer takes over the global drawer, not only when this one closes. The thread params are still in the URL, so this effect calls openDrawer again and replaces the other drawer right away.

I checked this with a throwaway spec. It renders the detail page with ?comments=open&commentsBlock=block-1 next to a component that calls useDrawer().openDrawer(...). After opening it, only "Block comments" is on screen. Without the thread params, the other drawer opens normally.

In the app, Seer Explorer in drawer mode is one way to hit this: open a thread, then ⌘K → Ask Seer. The palette is a modal, so the outside-click handler skips it and the URL params stay.

useDroppedDataDrawer guards with isAnyDrawerOpen. That alone would stop a block's Comment action from opening the thread while Explorer is open, though. Clearing the params when this drawer is replaced may fit better: remember that it was open, and on a true → false change with the URL still saying open, call closeBlockComments() instead of reopening.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed, but not by clearing the URL right away — that would also close most other drawers (they close on navigation). The thread now stays closed while another drawer is open and is cleared from the URL once that drawer closes.

);
}, [setDrawerQuery]);

useOnClickOutside(panelRef, event => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 UX: Any click outside the drawer closes it and unmounts the composer, so an unsent reply is lost. A likely case is clicking into the block to re-read a chart or select a value while writing about it. The drawer is passive, so the page stays interactive, which makes that more likely. Some options: skip the outside-click close while the composer has text, keep drafts per block outside the drawer, or drop the outside-click close and rely on Esc and the header's close button.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We now save this per block, with a 7 day ttl so that we don't lose draft replies.

Comment thread static/app/views/investigations/comments/blockCommentsDrawer.tsx Outdated
Comment thread static/app/views/investigations/comments/blockCommentsDrawer.tsx Outdated
Comment thread static/app/views/investigations/comments/useBlockCommentsDrawer.tsx
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 95.74% 95.74% ±0%
Typed 142,139 142,229 🟢 +90
Untyped 6,330 6,331 🔴 +1
🔍 1 new type safety issue introduced

Type assertions (as) (1 new)

File Line Detail
static/app/views/investigations/comments/commentDrafts.ts 14 as Drafts — JSON.parse(localStorageWrapper.getItem(STORAGE_KEY) ?? '{}') as Drafts

This is informational only and does not block the PR.

@wedamija
wedamija force-pushed the danf/investigations-activity-edit branch from 60c6095 to 4dd7894 Compare October 15, 2026 22:40
@wedamija
wedamija force-pushed the danf/investigations-block-comments-drawer branch from 7aa91e1 to dcad0e8 Compare October 15, 2026 22:40
Base automatically changed from danf/investigations-activity-edit to master October 15, 2026 23:05
A block's menu has a "Comment" item that opens the block's thread in a side drawer. The thread shows comments oldest first, with a composer to reply. The drawer's state is kept in the URL so a linked comment is highlighted, and a click outside the drawer closes it. Unsent replies are kept per block for 7 days.
@wedamija
wedamija merged commit e332279 into master Oct 16, 2026
73 checks passed
@wedamija
wedamija deleted the danf/investigations-block-comments-drawer branch October 16, 2026 03:27
@billyvg

billyvg commented Oct 16, 2026

Copy link
Copy Markdown
Member

Visual QA

Screenshots from Scraps stories (fixture data, 1440×900, light theme). "Before" is the #127576 head.

Story coverage: GlobalDrawer renders drawer content where it is mounted, which in Scraps is the page root, outside the story's fixture organization and query client. So a thread opened from a story requested /organizations/sentry-sdks/investigations/commented-invoice-timeouts/ from production (404) and showed an error. Its reply box would also have posted to production. I mounted a GlobalDrawer inside InvestigationFixtureApi, filtered fixture comments by blockId, and gave the query block a thread. That's in a local commit that isn't pushed yet; with it there were zero production calls.

before after
Block menu with Refine and Delete Block menu with Comment, Refine and Delete
this branch's stories as-is with the fixture drawer
Drawer showing There was an error loading data Drawer with the block's thread
deep-linked comment reply from the drawer
Thread with a highlighted comment Reply in the thread and in Activity

Checked in the browser:

  • The thread lists comments oldest first.
  • ?comments=open&commentsBlock=…&comment=… highlights the linked comment.
  • A reply lands in the thread and at the top of Activity, and the count goes to 8.
  • Clicking outside closes the drawer and clears the URL.

Nit: the highlight is hard to see. The secondary background measured rgb(248, 248, 249) on white, so a deep link may not visibly land anywhere.

Story note: threads open from the URL, so on the multi-story Detail page every mounted investigation page opens its own drawer. The new comments story keeps a single page for that reason.

wedamija added a commit that referenced this pull request Oct 16, 2026
)

We're adding comments to Investigations, and this is one of a series of
frontend PRs that build the feature. Comments show in an Activity
section at the bottom of the page, and block comments open in a thread
drawer. Everything is behind the `investigations` flag.

This PR adds more ways to open a block's thread:
- A comment button on each block. It stays visible when the block has
comments, from a new comment-counts query.
- In the Activity feed, "Name commented on <block>" links the block name
to that comment in the drawer.
- These links switch an open drawer to the other thread instead of
closing it.
- Text blocks use a grid layout so the button sits in the header.

Stacked on #127590. This is the
last PR in the series.

This branch was successfully deployed

1 active deployment
Preview — 59a5c777 Deployed Oct 15, 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.

3 participants