fix: address 3 PR review findings in subtask title display

- OverflowDescription: always render <Tooltip> wrapper and control
  visibility via open prop (open={isOverflowing ? undefined : false})
  to prevent React unmounting/remounting the <p> on isOverflowing toggle
- OverflowDescription: add `text` to useEffect dependency array so
  overflow is re-measured when text content changes
- extractSubtaskTitle: guard against degenerate maxLength < 1 by
  returning '' immediately after the empty-input early return

Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
AndyMik90
2026-02-18 15:05:51 +01:00
co-authored by Claude Opus 4.6
parent 738aa29515
commit dd72e956b5
2 changed files with 14 additions and 16 deletions
@@ -34,26 +34,22 @@ function OverflowDescription({ text }: { text: string }) {
const observer = new ResizeObserver(check);
observer.observe(el);
return () => observer.disconnect();
}, [el]);
}, [el, text]);
const content = (
<p ref={setEl} className="mt-1 text-xs text-muted-foreground line-clamp-2 break-words">
{text}
</p>
);
if (isOverflowing) {
return (
<Tooltip>
<TooltipTrigger asChild>{content}</TooltipTrigger>
return (
<Tooltip open={isOverflowing ? undefined : false}>
<TooltipTrigger asChild>
<p ref={setEl} className="mt-1 text-xs text-muted-foreground line-clamp-2 break-words">
{text}
</p>
</TooltipTrigger>
{isOverflowing && (
<TooltipContent side="bottom" className="max-w-sm">
<p className="text-xs">{text}</p>
</TooltipContent>
</Tooltip>
);
}
return content;
)}
</Tooltip>
);
}
export function TaskSubtasks({ task }: TaskSubtasksProps) {
@@ -25,6 +25,8 @@ export function extractSubtaskTitle(description: string | undefined | null, maxL
return '';
}
if (maxLength < 1) return '';
const trimmed = description.trim();
// Short enough — return as-is unless the string contains a period-whitespace