Skip to content

ref(explorer): cleanup UI interrupt state and panel code#112446

Merged
aliu39 merged 8 commits into
masterfrom
aliu/timeout
Apr 13, 2026
Merged

ref(explorer): cleanup UI interrupt state and panel code#112446
aliu39 merged 8 commits into
masterfrom
aliu/timeout

Conversation

@aliu39
Copy link
Copy Markdown
Member

@aliu39 aliu39 commented Apr 8, 2026

Code organization and cleanup for explorer chat UI, before implementing a polling timeout. Should not affect current functionality.

Refactors:

  • Use helpers _onNewRequest and _onRequestError for repeated interrupt/waiting state management in useSeerExplorer. This will soon include timeout state

  • Moves the "response complete" detection from inline code (ran every render) into a useEffect. In general we could use a lot less useEffect's but seems correct here - reducing effects is a larger refactor for another day

  • Simplifies interrupt detection by removing the prevInterruptRequestedRef approach — wasJustInterrupted is now set directly when polling stops after an interrupt request.

  • startNewSession delegates to switchToRun(null) to deduplicate code

  • Simplifies the readOnly computation in explorerPanel by removing defensive type-checking around useUser(). The comment is not accurate

  • Simplify props for disabled textarea in case of read-only

Cleanup:

  • Removes the always-poll-when-drawer-open (isSeerDrawerOpen) condition. Chat is no longer embedded into seer drawer.

  • Removes clearWasJustInterrupted from hook API. Clearing on user request + switch session is sufficient

  • Removes isPending from the hook's return value (unused externally and not useful due to polling)

@aliu39 aliu39 requested a review from a team as a code owner April 8, 2026 03:08
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 8, 2026
Comment thread static/app/views/seerExplorer/explorerPanel.tsx
Comment thread static/app/views/seerExplorer/explorerPanel.tsx
Removed timeout management from waiting and interrupt helpers.
Comment thread static/app/views/seerExplorer/explorerPanel.tsx
Comment thread static/app/views/seerExplorer/hooks/useSeerExplorer.tsx Outdated
Comment thread static/app/views/seerExplorer/hooks/useSeerExplorer.tsx
Comment thread static/app/views/seerExplorer/explorerPanel.tsx
Copy link
Copy Markdown
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 prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Premature polling stop when session data is null
    • Added explicit check for filteredSessionData in useEffect condition to ensure waitingForResponse is only cleared when session data actually exists and is not loading.

Create PR

Or push these changes by commenting:

@cursor push 0f6a2c5c44
Preview (0f6a2c5c44)
diff --git a/static/app/views/seerExplorer/hooks/useSeerExplorer.tsx b/static/app/views/seerExplorer/hooks/useSeerExplorer.tsx
--- a/static/app/views/seerExplorer/hooks/useSeerExplorer.tsx
+++ b/static/app/views/seerExplorer/hooks/useSeerExplorer.tsx
@@ -563,7 +563,7 @@
       filteredSessionData.blocks.some((block: Block) => block.loading));
 
   useEffect(() => {
-    if (waitingForResponse && !isLoading) {
+    if (waitingForResponse && filteredSessionData && !isLoading) {
       // Stop waiting once we see the response is no longer loading
       setWaitingForResponse(false);
       // Clear deleted index once response is complete
@@ -574,7 +574,7 @@
         setWasJustInterrupted(true); // set persistent UI flag until next request
       }
     }
-  }, [waitingForResponse, interruptRequested, isLoading]);
+  }, [waitingForResponse, interruptRequested, isLoading, filteredSessionData]);
 
   return {
     sessionData: filteredSessionData,

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

Reviewed by Cursor Bugbot for commit 5cc6add. Configure here.

Comment thread static/app/views/seerExplorer/hooks/useSeerExplorer.tsx Outdated
Comment thread static/app/views/seerExplorer/hooks/useSeerExplorer.tsx
@aliu39 aliu39 merged commit fd6b128 into master Apr 13, 2026
62 checks passed
@aliu39 aliu39 deleted the aliu/timeout branch April 13, 2026 21:36
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 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.

2 participants