fix(frontend): Separate pause state from agent loading#12041
fix(frontend): Separate pause state from agent loading#12041amanape merged 3 commits intoOpenHands:mainfrom
Conversation
|
Hi @Mariam-Saeed, could you please add tests for your changes? We are aiming to enforce stronger testing practices on the frontend. Thank you! 🙏 |
amanape
left a comment
There was a problem hiding this comment.
Hey, thank you very much for opening this PR! I just have one suggestion:
There was a problem hiding this comment.
There are multiple shouldShownAgentLoading conditions used in this file. Your change only updates line 100, but the other conditions still use shouldShownAgentLoading without considering isPausing. Consider introducing a local variable that combines both states for UI rendering, while keeping the current shouldShownAgentLoading for the global state update:
const shouldShownAgentLoading =
curAgentState === AgentState.INIT ||
curAgentState === AgentState.LOADING ||
(webSocketStatus === "CONNECTING" && taskStatus !== "ERROR") ||
isTaskPolling(taskStatus) ||
isTaskPolling(subConversationTaskStatus);
// For UI rendering - includes pause state
const isLoading = shouldShownAgentLoading || isPausing;Then use isLoading in the JSX for consistent behavior across all conditions, while shouldShownAgentLoading continues to be used for the global state in the useEffect.
There was a problem hiding this comment.
I've added a local variable to handle the loading state, with unit tests to cover its behavior and ensure it works correctly.
Co-authored-by: amanape <83104063+amanape@users.noreply.github.com>
Summary of PR
This PR fixes the issue where pausing the agent incorrectly triggered loading on the action panel.
This separates the pause state from the global loading state, improving UI consistency.
Change Type
Checklist
Fixes
Resolves #12035
Release Notes