Skip to content

adds chat panel to generate dashboards flow#110725

Merged
edwardgou-sentry merged 4 commits intomasterfrom
egou/feat/generate-dashboard-chat
Mar 17, 2026
Merged

adds chat panel to generate dashboards flow#110725
edwardgou-sentry merged 4 commits intomasterfrom
egou/feat/generate-dashboard-chat

Conversation

@edwardgou-sentry
Copy link
Contributor

Adds a chat panel to the seer generate dashboards flow that accepts user prompts for further dashboard modification

  • Updates DashboardDetail to rerender on dashboard prop change on preview mode. This is for rerendering on receiving new generated dashboards.
  • Adds a DashboardChatPanel component to handle user input and chat history display
  • Updates CreateFromSeer component to handle interactivity and generated dashboard reloading
image

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 16, 2026
@edwardgou-sentry edwardgou-sentry marked this pull request as ready for review March 16, 2026 12:50
@edwardgou-sentry edwardgou-sentry requested a review from a team as a code owner March 16, 2026 12:50
Copy link
Contributor

@cursor cursor bot left a comment

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 2 potential issues.

Autofix Details

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Removed error notification for failed dashboard generation
    • Added useEffect that calls addErrorMessage when sessionStatus is 'error' or isError is true, restoring the missing error notification.
  • ✅ Fixed: Stuck updating state when backend responds quickly
    • Updated transition detection to also trigger when session data changes while already in terminal state (completed → completed), preventing stuck updating state.

Create PR

Or push these changes by commenting:

@cursor push 0807ea206f
Preview (0807ea206f)
diff --git a/static/app/views/dashboards/createFromSeer.tsx b/static/app/views/dashboards/createFromSeer.tsx
--- a/static/app/views/dashboards/createFromSeer.tsx
+++ b/static/app/views/dashboards/createFromSeer.tsx
@@ -113,6 +113,7 @@
   const [dashboard, setDashboard] = useState<DashboardDetails>(EMPTY_DASHBOARD);
   const [isUpdating, setisUpdating] = useState(false); // State tracks if dashboard is being updated from user chat input
   const prevSessionStatusRef = useRef<string | null>(null);
+  const prevSessionRef = useRef<NonNullable<SeerExplorerResponse['session']> | null>(null);
 
   const {data, isError} = useApiQuery<SeerExplorerResponse>(
     makeSeerExplorerQueryKey(organization.slug, seerRunId),
@@ -137,14 +138,27 @@
   const sessionStatus = session?.status ?? null;
 
   useEffect(() => {
+    if (sessionStatus === 'error' || isError) {
+      addErrorMessage(t('Failed to generate dashboard'));
+    }
+  }, [sessionStatus, isError]);
+
+  useEffect(() => {
     const prevStatus = prevSessionStatusRef.current;
+    const prevSession = prevSessionRef.current;
     prevSessionStatusRef.current = sessionStatus;
+    prevSessionRef.current = session;
 
     const wasTerminal = prevStatus === 'completed' || prevStatus === 'error';
     const isTerminal = sessionStatus === 'completed' || sessionStatus === 'error';
 
-    // Only trigger Dashboard rerender when transition from updating state to completed state
-    if (!wasTerminal && isTerminal && session) {
+    // Trigger Dashboard rerender when:
+    // 1. Transition from updating state to completed state (!wasTerminal && isTerminal)
+    // 2. Session data changed while already in terminal state (for fast backend responses)
+    const shouldUpdate =
+      (!wasTerminal && isTerminal) || (wasTerminal && isTerminal && session !== prevSession);
+
+    if (shouldUpdate && session) {
       if (isUpdating) {
         setisUpdating(false);
       }

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@edwardgou-sentry edwardgou-sentry marked this pull request as draft March 16, 2026 17:39
@edwardgou-sentry edwardgou-sentry marked this pull request as ready for review March 16, 2026 18:28
Copy link
Contributor

@cursor cursor bot left a comment

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.

Copy link
Member

@narsaynorath narsaynorath left a comment

Choose a reason for hiding this comment

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

Looks good to me, just some future improvement suggestions I noticed when using it. Also it would be nice if the text prompt you give it optimistically added itself to the blocks without waiting for the POST request to come back with some stuff, so it feels more immediate

dashboard={dashboard}
dashboards={[]}
/>
<DashboardChatPanel
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can style this with absolute positioning or something so it doesn't push the footer down. Can be a follow up.

}
}, [isUpdating]);

// Scroll chat to bottom when new blocks arrive
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice if it scrolled to the bottom when it's opened as well. e.g. when it auto opens after I type into it when it's closed, I have to wait until the new block or scroll down

@edwardgou-sentry edwardgou-sentry merged commit df817f3 into master Mar 17, 2026
63 checks passed
@edwardgou-sentry edwardgou-sentry deleted the egou/feat/generate-dashboard-chat branch March 17, 2026 14:54
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