Skip to content

feat(explorer): migrate chat UI to global drawer#113481

Merged
aliu39 merged 35 commits into
masterfrom
aliu/drawer-migration
Apr 21, 2026
Merged

feat(explorer): migrate chat UI to global drawer#113481
aliu39 merged 35 commits into
masterfrom
aliu/drawer-migration

Conversation

@aliu39

@aliu39 aliu39 commented Apr 20, 2026

Copy link
Copy Markdown
Member

Re-implements the contents and functionality of the floating chat panel (useGlobalPortal) for useDrawer.

The global SeerExplorerContext is moved under OrganizationLayout, and updated to use the drawer hook.

  • callbacks and global cmd slash hotkey is updated to trigger the drawer
  • to prevent cmd slash from closing other drawers, track whether explorer is open in an internal ref
  • isMinimized, isOpen/Visible, isSeerDrawerOpen state is not applicable to the drawer. isMobile is not supported. Unlike the old global panel, the chat content is either mounted and visible, or isn't. This is the key difference between ExplorerDrawerContent and ExplorerPanel.

Supports old explorerPanel the old FAB when the page frame FF is off. This is a hard cutover to the drawer version and will go out to all current beta users on merge. When the feature releases later this week, page frame will also GA, and FAB will get phased out.

Migrates the 2 external opens - instrumentationFixSection and night shift cmd K (both internal features) - to open the drawer after seeding a run_id in sessionStorage. Sending an initial message isn't supported for now, no code uses it.

Demo of basic open/close, send message, switch session, persist current session through open/close -
https://github.com/user-attachments/assets/ffcf6545-c0f1-4063-a711-572413be726c

to be done in a follow-up:

  • Topbar/menu style updates (x button will go on left)
  • deep links and runId URL param are temporarily not supported. Support in a follow-up
  • support sending an initial msg from openSeerExplorer, like the old API (renamed to openSeerExplorerPanel.tsx)

@aliu39
aliu39 requested review from a team as code owners April 20, 2026 21:12
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 20, 2026
Comment thread static/app/views/seerExplorer/components/drawer/useSeerExplorerDrawer.tsx Outdated
Comment thread static/app/views/seerExplorer/components/drawer/explorerDrawerContent.tsx Outdated
Comment thread static/app/views/seerExplorer/useSeerExplorerContext.tsx
Comment thread static/app/views/seerExplorer/useSeerExplorerContext.tsx Outdated
Comment thread static/app/views/seerExplorer/components/drawer/useSeerExplorerDrawer.tsx Outdated
Comment thread static/app/views/seerExplorer/components/topBar.tsx Outdated
Comment thread static/app/views/seerExplorer/useSeerExplorerContext.tsx Outdated
Comment thread static/app/views/seerExplorer/components/drawer/useSeerExplorerDrawer.tsx Outdated
Comment thread static/app/views/seerExplorer/components/drawer/useSeerExplorerDrawer.tsx Outdated
Comment thread static/app/views/seerExplorer/components/drawer/useSeerExplorerDrawer.tsx Outdated
@JonasBa

JonasBa commented Apr 20, 2026

Copy link
Copy Markdown
Contributor
CleanShot 2026-04-20 at 15 46 57 Can we align these two heights? It will also help with the transparent buttons no longer being crammed edge to edge.

@aliu39

aliu39 commented Apr 20, 2026

Copy link
Copy Markdown
Member Author

CleanShot 2026-04-20 at 15 46 57 Can we align these two heights? It will also help with the transparent buttons no longer being crammed edge to edge.

@JonasBa for sure, I'm planning to make follow-up PRs for styles after this merges (to closed beta, not GA) updating the top bar to Ivy's designs in https://www.figma.com/design/3Pfh2LX1K4MXhyJYWPDkNw/Seer-Explorer---Agent?node-id=716-4361&p=f&t=nmrXjrG1tiTK4RkB-0 . Looks like the height alignment is there, and all the extraneous buttons will go in the ... button

@aliu39
aliu39 requested a review from a team April 20, 2026 23:06
Comment thread static/app/views/seerExplorer/components/panel/explorerPanel.tsx Outdated
Comment thread static/app/views/seerExplorer/components/panel/explorerPanel.tsx Outdated

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.

I know most of this copy paste but it'd be good to break this component into smaller helpers to handle the various interactions instead of all these hooks in the single component.

export type OpenSeerExplorerDrawerOptions = {
/**
* Optional run ID to open. If provided, opens an existing session.
* Cannot be used together with `startNewRun`.

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.

nit: if this is the case then you can enforce it with types via a discriminator field

Comment thread static/app/views/seerExplorer/components/drawer/useSeerExplorerDrawer.tsx Outdated
}}
/>
)}
<Button

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.

Noticed this is still not matching the designs where the close / new buttons are flipped—are you planning on doing that in a follow-up?

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.

You'd also get the close button for free if you used the DrawerHeader component from @sentry/scraps/drawer

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.

After thinking it through, this should probably be a follow-up!

@natemoo-re natemoo-re 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.

Looking good! Once tests are passing, go ahead and merge.

Comment thread static/app/views/seerExplorer/useSeerExplorerContext.tsx
Comment thread static/app/views/seerExplorer/utils.tsx Outdated
Comment thread static/app/views/seerExplorer/components/panel/explorerPanel.tsx Outdated
Delete the deprecated ExplorerPanel component (superseded by useSeerExplorerDrawer)
and its supporting files (panelContainers, openSeerExplorerPanel, usePanelSizing).
Extract ExplorerFloatingActionButton into explorerFAB.tsx. Remove dead exports
(simulateSeerExplorerKeyboardShortcut, PanelSize, RUN_ID_QUERY_PARAM).

Co-Authored-By: Claude <noreply@anthropic.com>

@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 9a0ff54. Configure here.

Comment on lines +83 to +93
ariaLabel: t('Seer Explorer Drawer'),
drawerKey: 'seer-explorer-drawer',
resizable: true,
mode: 'passive',
// XXX: passive mode keeps drawer open on location change. Be sure to update isOpenRef if closing on change is needed - useDrawer doesn't call onClose
onOpen,
onClose,
}
);
},
[openDrawer, closeSeerExplorerDrawer, onOpen, onClose, getPageReferrer]

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: Calling openSeerExplorerDrawer while the drawer is already open fires a duplicate seer.explorer.global_panel.opened analytics event because the onOpen callback is called unconditionally.
Severity: MEDIUM

Suggested Fix

Add a guard to prevent the onOpen callback from being executed if the drawer is already open. This can be done by checking a state reference like isOpenRef.current before calling openDrawer or before firing the analytics event inside the onOpen callback.

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/seerExplorer/components/drawer/useSeerExplorerDrawer.tsx#L75-L93

Potential issue: When `openSeerExplorerDrawer` is called while the drawer is already
open, such as when switching between sessions, it unconditionally calls `openDrawer`.
This in turn invokes the provided `onOpen` callback every time. The `onOpen` function is
responsible for firing the `seer.explorer.global_panel.opened` analytics event but lacks
a guard to check if the drawer is already open. This results in duplicate analytics
events being fired for a single continuous drawer session, which will artificially
inflate metrics for this event.

@aliu39
aliu39 merged commit 0018d6c into master Apr 21, 2026
65 checks passed
@aliu39
aliu39 deleted the aliu/drawer-migration branch April 21, 2026 23:01
@github-actions github-actions Bot locked and limited conversation to collaborators May 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants