Fix issue #8682: [Bug]: Terminal tab not showing content until page refresh #8683
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
persistentLastCommandIndex
with a component-localReact.useRef
, allowing proper state management per terminal instanceterminal.current.reset()
when commands change, ensuring the terminal clears properly before re-renderingThe 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: