mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-10 04:00:24 +00:00
fix: prevent selected file from entering loading state when new files are added
This commit is contained in:
parent
1774581034
commit
d3401a3ee2
2 changed files with 27 additions and 25 deletions
|
|
@ -331,7 +331,7 @@ export default function Folder({ data }: { data?: Agent }) {
|
|||
(item: any) => item.name === chatStoreSelectedFile.name
|
||||
);
|
||||
console.log("file", file);
|
||||
if (file) {
|
||||
if (file && selectedFile?.path !== chatStoreSelectedFile?.path) {
|
||||
selectedFileChange(file as FileInfo, isShowSourceCode);
|
||||
}
|
||||
}
|
||||
|
|
@ -353,7 +353,7 @@ export default function Folder({ data }: { data?: Agent }) {
|
|||
const file = fileGroups[0].files.find(
|
||||
(item: any) => item.path === chatStoreSelectedFile.path
|
||||
);
|
||||
if (file) {
|
||||
if (file && selectedFile?.path !== chatStoreSelectedFile?.path) {
|
||||
selectedFileChange(file as FileInfo, isShowSourceCode);
|
||||
}
|
||||
}
|
||||
|
|
@ -361,7 +361,7 @@ export default function Folder({ data }: { data?: Agent }) {
|
|||
chatStore.tasks[chatStore.activeTaskId as string]?.selectedFile?.path,
|
||||
fileGroups,
|
||||
isShowSourceCode,
|
||||
chatStore.activeTaskId
|
||||
chatStore.activeTaskId,
|
||||
]);
|
||||
|
||||
const handleBack = () => {
|
||||
|
|
@ -456,7 +456,7 @@ export default function Folder({ data }: { data?: Agent }) {
|
|||
{fileGroups.map((group) =>
|
||||
group.files.map((file) => (
|
||||
<button
|
||||
key={file.name}
|
||||
key={file.path}
|
||||
onClick={() => selectedFileChange(file, isShowSourceCode)}
|
||||
className={`w-full flex items-center justify-center p-2 rounded-md hover:bg-fill-fill-primary-hover transition-colors ${
|
||||
selectedFile?.name === file.name
|
||||
|
|
|
|||
|
|
@ -102,30 +102,32 @@ export const TaskState = ({
|
|||
</div>
|
||||
|
||||
{/* Reassigned */}
|
||||
{reAssignTo && <div
|
||||
className={`group hover:bg-tag-surface flex gap-xs items-center px-0.5 py-0.5 transition-all duration-200 ${
|
||||
isSelected("reassigned") && "bg-tag-surface"
|
||||
} ${
|
||||
clickable && "cursor-pointer hover:opacity-80 transition-opacity"
|
||||
}`}
|
||||
onClick={() => handleStateClick("reassigned")}
|
||||
>
|
||||
<CircleSlash2
|
||||
className={`w-[10px] h-[10px] text-icon-secondary group-hover:text-icon-warning ${
|
||||
isSelected("reassigned") && "text-icon-warning"
|
||||
}`}
|
||||
/>
|
||||
<span
|
||||
className={`transition-all duration-200 text-xs leading-tight font-normal text-text-label group-hover:text-text-warning ${
|
||||
isSelected("reassigned") && "text-text-warning"
|
||||
{reAssignTo ? (
|
||||
<div
|
||||
className={`group hover:bg-tag-surface flex gap-xs items-center px-0.5 py-0.5 transition-all duration-200 ${
|
||||
isSelected("reassigned") && "bg-tag-surface"
|
||||
} ${
|
||||
clickable && "cursor-pointer hover:opacity-80 transition-opacity"
|
||||
}`}
|
||||
onClick={() => handleStateClick("reassigned")}
|
||||
>
|
||||
Reassigned{" "}
|
||||
<span className={fadeWidthClass(isSelected("reassigned"))}>
|
||||
{reAssignTo}
|
||||
<CircleSlash2
|
||||
className={`w-[10px] h-[10px] text-icon-secondary group-hover:text-icon-warning ${
|
||||
isSelected("reassigned") && "text-icon-warning"
|
||||
}`}
|
||||
/>
|
||||
<span
|
||||
className={`transition-all duration-200 text-xs leading-tight font-normal text-text-label group-hover:text-text-warning ${
|
||||
isSelected("reassigned") && "text-text-warning"
|
||||
}`}
|
||||
>
|
||||
Reassigned{" "}
|
||||
<span className={fadeWidthClass(isSelected("reassigned"))}>
|
||||
{reAssignTo}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{/* Ongoing */}
|
||||
<div
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue