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

[Bug]: The file editor is displaying the wrong content. #1901

Closed
2 tasks done
Shimada666 opened this issue May 19, 2024 · 8 comments
Closed
2 tasks done

[Bug]: The file editor is displaying the wrong content. #1901

Shimada666 opened this issue May 19, 2024 · 8 comments
Labels
bug Something isn't working frontend issues related to frontend severity:low Minor issues, code cleanup, etc

Comments

@Shimada666
Copy link
Contributor

Is there an existing issue for the same bug?

Describe the bug

After clicking refresh icon, the displayed file content becomes incorrect. However, upon inspecting using F12, the data returned from the backend is correct. I will debug and fix this issue later.

QQ20240519-175458-HD.mp4

Current Version

main

Installation and Configuration

npm run start

Model and Agent

No response

Reproduction Steps

No response

Logs, Errors, Screenshots, and Additional Context

No response

@Shimada666 Shimada666 added the bug Something isn't working label May 19, 2024
@Shimada666
Copy link
Contributor Author

Shimada666 commented May 19, 2024

How to reproduce:

  1. Create files named aaa.sh and tmp/bbb.sh.
  2. First, view the aaa.sh file, then view the tmp/bbb.sh file, and finally re-visit the aaa.sh file. You will notice that the content is incorrect.

I can confirm it's a redux issue because when I store the code using useState, the bug fixed. Later, I will see if I can refactor it.

@SmartManoj
Copy link
Collaborator

Working fine here. That sh file should be inside the tree. How it replaced the workspace title?

image

@Shimada666
Copy link
Contributor Author

@SmartManoj
You need to create aaa.sh and tmp/bbb.sh. Please note that bbb.sh is inside the tmp folder, and then you can reproduce it. I provide a video.

QQ20240519-215938-HD.mp4

@PierrunoYT
Copy link
Contributor

I had some similar issues

@SmartManoj
Copy link
Collaborator

@Shimada666 Yes, affecting in latest versions even without nested dirs.
If two files are there a and b,
The first time clicking a -> works
clicking b -> works
then clicking again doesn't work

@SmartManoj
Copy link
Collaborator

SmartManoj commented May 20, 2024

This PR #1853 introduced this?
Workaround: View files in IDE

@SmartManoj SmartManoj added the severity:low Minor issues, code cleanup, etc label May 20, 2024
@amanape
Copy link
Collaborator

amanape commented May 20, 2024

It may be related to how the active file path is being updated. I can't do it today, so maybe you can take a look somewhere here?

const filename =
fileParts[fileParts.length - 1] || fileParts[fileParts.length - 2];
const isDirectory = path.endsWith("/");
const refreshChildren = async () => {
if (!isDirectory || !isOpen) {
setChildren(null);
return;
}
const files = await listFiles(path);
setChildren(files);
};
React.useEffect(() => {
refreshChildren();
}, [refreshID, isOpen]);
const handleClick = () => {
if (isDirectory) {
setIsOpen((prev) => !prev);
} else {
dispatch(setActiveFilepath(path));
}
};

@amanape amanape added the frontend issues related to frontend label May 20, 2024
@Shimada666
Copy link
Contributor Author

@SmartManoj @amanape The latest the code does not seem to have this issue, I will close this issue.
Thank you all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend issues related to frontend severity:low Minor issues, code cleanup, etc
Projects
None yet
Development

No branches or pull requests

4 participants