Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: hide Notes from task list when notes are empty (#12668)

MkDev119e1ae86191e2
diff --git a/frontend/__tests__/components/features/chat/task-tracking-observation-content.test.tsx b/frontend/__tests__/components/features/chat/task-tracking-observation-content.test.tsx
index 5db3942aa2..a905b77c92 100644
--- a/frontend/__tests__/components/features/chat/task-tracking-observation-content.test.tsx
+++ b/frontend/__tests__/components/features/chat/task-tracking-observation-content.test.tsx
@@ -97,6 +97,15 @@ describe("TaskTrackingObservationContent", () => {
).toBeInTheDocument();
});
+ it("does not display Notes when notes are empty", () => {
+ render(<TaskTrackingObservationContent event={mockEvent} />);
+
+ // task-2 has no notes, so "Notes:" should not appear for it
+ // We have 2 tasks with notes, so there should be exactly 2 "Notes:" elements
+ const notesElements = screen.getAllByText(/^Notes:/);
+ expect(notesElements).toHaveLength(2);
+ });
+
it("does not render task list when command is not 'plan'", () => {
const eventWithoutPlan = {
...mockEvent,
diff --git a/frontend/src/components/features/chat/task-tracking/task-item.tsx b/frontend/src/components/features/chat/task-tracking/task-item.tsx
index 9dac504769..bb997ca139 100644
--- a/frontend/src/components/features/chat/task-tracking/task-item.tsx
+++ b/frontend/src/components/features/chat/task-tracking/task-item.tsx
@@ -52,9 +52,11 @@ export function TaskItem({ task }: TaskItemProps) {
<Typography.Text className="text-[10px] text-[#A3A3A3] font-normal">
{t(I18nKey.TASK_TRACKING_OBSERVATION$TASK_ID)}: {task.id}
</Typography.Text>
- <Typography.Text className="text-[10px] text-[#A3A3A3]">
- {t(I18nKey.TASK_TRACKING_OBSERVATION$TASK_NOTES)}: {task.notes}
- </Typography.Text>
+ {task.notes && (
+ <Typography.Text className="text-[10px] text-[#A3A3A3]">
+ {t(I18nKey.TASK_TRACKING_OBSERVATION$TASK_NOTES)}: {task.notes}
+ </Typography.Text>
+ )}
</div>
</div>
);
diff --git a/frontend/src/components/v1/chat/task-tracking/task-item.tsx b/frontend/src/components/v1/chat/task-tracking/task-item.tsx
index a50b6829d3..a50d58a95a 100644
--- a/frontend/src/components/v1/chat/task-tracking/task-item.tsx
+++ b/frontend/src/components/v1/chat/task-tracking/task-item.tsx
@@ -45,9 +45,11 @@ export function TaskItem({ task }: TaskItemProps) {
>
{task.title}
</Typography.Text>
- <Typography.Text className="text-[10px] text-[#A3A3A3]">
- {t(I18nKey.TASK_TRACKING_OBSERVATION$TASK_NOTES)}: {task.notes}
- </Typography.Text>
+ {task.notes && (
+ <Typography.Text className="text-[10px] text-[#A3A3A3]">
+ {t(I18nKey.TASK_TRACKING_OBSERVATION$TASK_NOTES)}: {task.notes}
+ </Typography.Text>
+ )}
</div>
</div>
);