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 bug in file switching #4577

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PierrunoYT
Copy link
Contributor

@PierrunoYT PierrunoYT commented Oct 26, 2024

Fixes #4576

Add debounce mechanism to handle rapid file switching in the editor.

  • frontend/src/context/files.tsx

    • Import debounce from lodash.
    • Add debouncedSetSelectedPath to handle rapid file switching.
    • Update value to use debouncedSetSelectedPath.
  • frontend/src/components/file-explorer/FileExplorer.tsx

    • Import debounce from lodash.
    • Add debouncedSetSelectedPath to handle rapid file switching.
    • Update FileExplorer to use debouncedSetSelectedPath.
  • frontend/src/routes/_oh.app._index/route.tsx

    • Import debounce from lodash.
    • Add debouncedSetSelectedPath to handle rapid file switching.
    • Update CodeEditor to use debouncedSetSelectedPath.

For more details, open the Copilot Workspace session.

Fixes All-Hands-AI#4576

Add debounce mechanism to handle rapid file switching in the editor.

* **frontend/src/context/files.tsx**
  - Import `debounce` from `lodash`.
  - Add `debouncedSetSelectedPath` to handle rapid file switching.
  - Update `value` to use `debouncedSetSelectedPath`.

* **frontend/src/components/file-explorer/FileExplorer.tsx**
  - Import `debounce` from `lodash`.
  - Add `debouncedSetSelectedPath` to handle rapid file switching.
  - Update `FileExplorer` to use `debouncedSetSelectedPath`.

* **frontend/src/routes/_oh.app._index/route.tsx**
  - Import `debounce` from `lodash`.
  - Add `debouncedSetSelectedPath` to handle rapid file switching.
  - Update `CodeEditor` to use `debouncedSetSelectedPath`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/All-Hands-AI/OpenHands/issues/4576?shareId=XXXX-XXXX-XXXX-XXXX).
* Enable previously skipped tests
* Add test for rendering an empty workspace
* Add test for uploading files by dragging them to the explorer
* Add test for downloading a file
* Add test for displaying correct file content when switching files quickly
Copy link
Contributor

@neubig neubig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @PierrunoYT , tests are failing could you please fix them and then re-request my review when you're done?

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]: UI Workspace clicking between files quickly while the agent is busy will corrupt editor state
2 participants