Skip to content
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

Fix: Auto-refresh file content when selected file changes #5476

Merged
merged 3 commits into from
Dec 10, 2024

Conversation

tofarr
Copy link
Collaborator

@tofarr tofarr commented Dec 9, 2024

This PR fixes the issue where the file content in the workspace panel does not automatically refresh when the selected file changes externally. Now, when a file is selected and its content changes, it will automatically update without requiring the user to click on the file again.

Changes:

  • Added Redux store selector to get current agent state in TreeNode component
  • Added useEffect hook to trigger file content refetch when:
    • File is currently selected
    • File is not a directory
    • Agent state changes

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:217f8d3-nikolaik   --name openhands-app-217f8d3   docker.all-hands.dev/all-hands-ai/openhands:217f8d3

@mamoodi mamoodi requested a review from amanape December 9, 2024 19:19
@mamoodi
Copy link
Collaborator

mamoodi commented Dec 9, 2024

Should fix: #4968

@malhotra5 malhotra5 merged commit e27c2e9 into main Dec 10, 2024
14 checks passed
@malhotra5 malhotra5 deleted the fix-file-explorer-refresh branch December 10, 2024 02:17
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.

5 participants