Signed-off-by: OpenClaw Bot <ai-agent@topdoglabs.com>

This commit is contained in:
OpenClaw Bot 2026-02-26 13:22:42 -06:00
parent 95060930b1
commit bca83c682d
2 changed files with 31 additions and 6 deletions

View File

@ -42,6 +42,15 @@ const typeLabels: Record<string, string> = {
plan: "📐",
}
const UNSPRINTED_SENTINELS = new Set(["null", "none", "backlog", "unassigned", "no-sprint", "no_sprint"])
const normalizeSprintId = (value: string | undefined): string | undefined => {
if (typeof value !== "string") return undefined
const sprintId = value.trim()
if (!sprintId) return undefined
return UNSPRINTED_SENTINELS.has(sprintId.toLowerCase()) ? undefined : sprintId
}
interface AssignableUser {
id: string
name: string
@ -296,11 +305,16 @@ export function BacklogView() {
const otherSprints = sprints.filter((s) => s.id !== currentSprint?.id)
// Get tasks by section
const sprintIds = new Set(sprints.map((s) => s.id))
const currentSprintTasks = currentSprint
? tasks.filter((t) => t.sprintId === currentSprint.id)
? tasks.filter((t) => normalizeSprintId(t.sprintId) === currentSprint.id)
: []
const backlogTasks = tasks.filter((t) => !t.sprintId)
const backlogTasks = tasks.filter((t) => {
const sprintId = normalizeSprintId(t.sprintId)
return !sprintId || !sprintIds.has(sprintId)
})
// Get active task for drag overlay
const activeTask = activeId ? tasks.find((t) => t.id === activeId) : null
@ -319,11 +333,12 @@ export function BacklogView() {
const overId = over.id as string
const overTask = tasks.find((t) => t.id === overId)
const overTaskSprintId = overTask ? normalizeSprintId(overTask.sprintId) : undefined
const destinationId = overTask
? overTask.sprintId
? currentSprint && overTask.sprintId === currentSprint.id
? overTaskSprintId
? currentSprint && overTaskSprintId === currentSprint.id
? "current"
: `sprint-${overTask.sprintId}`
: `sprint-${overTaskSprintId}`
: "backlog"
: overId
@ -395,7 +410,7 @@ export function BacklogView() {
{otherSprints
.sort((a, b) => new Date(a.startDate).getTime() - new Date(b.startDate).getTime())
.map((sprint) => {
const sprintTasks = tasks.filter((t) => t.sprintId === sprint.id)
const sprintTasks = tasks.filter((t) => normalizeSprintId(t.sprintId) === sprint.id)
console.log(`Sprint ${sprint.name}: ${sprintTasks.length} tasks`, sprintTasks.map(t => t.title))
return (
<SectionDropZone key={sprint.id} id={`sprint-${sprint.id}`}>

View File

@ -477,8 +477,18 @@ const normalizeAttachments = (value: unknown): TaskAttachment[] => {
.filter((attachment): attachment is TaskAttachment => attachment !== null)
}
const UNSPRINTED_SENTINELS = new Set(['null', 'none', 'backlog', 'unassigned', 'no-sprint', 'no_sprint'])
const normalizeSprintId = (value: unknown): string | undefined => {
if (typeof value !== 'string') return undefined
const sprintId = value.trim()
if (sprintId.length === 0) return undefined
return UNSPRINTED_SENTINELS.has(sprintId.toLowerCase()) ? undefined : sprintId
}
const normalizeTask = (task: Task): Task => ({
...task,
sprintId: normalizeSprintId(task.sprintId),
comments: normalizeComments(task.comments),
tags: Array.isArray(task.tags) ? task.tags.filter((tag): tag is string => typeof tag === 'string' && tag.trim().length > 0) : [],
attachments: normalizeAttachments(task.attachments),