Fix all optional comments references - add null checks everywhere
This commit is contained in:
parent
c0ca8721e8
commit
118078fc75
@ -386,7 +386,7 @@ export default function Home() {
|
|||||||
<span className={priorityColors[task.priority]}>
|
<span className={priorityColors[task.priority]}>
|
||||||
{task.priority}
|
{task.priority}
|
||||||
</span>
|
</span>
|
||||||
{task.comments.length > 0 && (
|
{task.comments && task.comments.length > 0 && (
|
||||||
<span className="flex items-center gap-1 text-slate-500">
|
<span className="flex items-center gap-1 text-slate-500">
|
||||||
<MessageSquare className="w-3 h-3" />
|
<MessageSquare className="w-3 h-3" />
|
||||||
{task.comments.length}
|
{task.comments.length}
|
||||||
@ -633,12 +633,12 @@ export default function Home() {
|
|||||||
<div className="border-t border-slate-800 pt-6">
|
<div className="border-t border-slate-800 pt-6">
|
||||||
<h4 className="font-medium text-white mb-4 flex items-center gap-2">
|
<h4 className="font-medium text-white mb-4 flex items-center gap-2">
|
||||||
<MessageSquare className="w-4 h-4" />
|
<MessageSquare className="w-4 h-4" />
|
||||||
Notes & Comments ({editedTask.comments.length})
|
Notes & Comments ({editedTask.comments?.length || 0})
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
{/* Comment List */}
|
{/* Comment List */}
|
||||||
<div className="space-y-4 mb-4">
|
<div className="space-y-4 mb-4">
|
||||||
{editedTask.comments.length === 0 ? (
|
{!editedTask.comments || editedTask.comments.length === 0 ? (
|
||||||
<p className="text-slate-500 text-sm">No notes yet. Add the first one!</p>
|
<p className="text-slate-500 text-sm">No notes yet. Add the first one!</p>
|
||||||
) : (
|
) : (
|
||||||
editedTask.comments.map((comment) => (
|
editedTask.comments.map((comment) => (
|
||||||
|
|||||||
@ -101,7 +101,7 @@ function SortableTaskCard({
|
|||||||
<Badge variant="outline" className="text-xs border-slate-600 text-slate-400">
|
<Badge variant="outline" className="text-xs border-slate-600 text-slate-400">
|
||||||
{task.type}
|
{task.type}
|
||||||
</Badge>
|
</Badge>
|
||||||
{task.comments.length > 0 && (
|
{task.comments && task.comments.length > 0 && (
|
||||||
<span className="text-xs text-slate-500">
|
<span className="text-xs text-slate-500">
|
||||||
💬 {task.comments.length}
|
💬 {task.comments.length}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user