Skip to content

Fix issue #8682: [Bug]: Terminal tab not showing content until page refresh #8683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

openhands-agent
Copy link
Contributor

@openhands-agent openhands-agent commented May 24, 2025

This pull request fixes #8682.

The issue has been successfully resolved based on the changes made. The core problem was that the terminal wasn't displaying output until page refresh because it was using a persistent reference that prevented proper re-rendering. The specific changes address this by:

  1. Replacing the persistent persistentLastCommandIndex with a component-local React.useRef, allowing proper state management per terminal instance
  2. Adding terminal.current.reset() when commands change, ensuring the terminal clears properly before re-rendering
  3. Modifying the commands effect to re-render ALL commands when the array changes, rather than only rendering new ones
  4. Adding proper prompt handling after command rendering

The new test coverage demonstrates that the terminal now correctly re-renders all commands when reinitialized, which directly addresses the original issue of content not displaying until refresh. The changes ensure that command output will display immediately when executed, without requiring a page refresh.

The technical implementation is sound and the changes directly target and fix the reported behavior. The combination of proper terminal reset, complete command re-rendering, and local state management provides a complete solution to the UI bug.

Automatic fix generated by OpenHands 🙌


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:f52a653-nikolaik   --name openhands-app-f52a653   docker.all-hands.dev/all-hands-ai/openhands:f52a653

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Terminal tab not showing content until page refresh
1 participant