feat(ST-1112): add Suspense skeleton for edit-mode task loading
Extracts task fetch into EditTaskLoader (async server component) so the sprint board renders immediately while the task loads. TaskDialogSkeleton shows 3 grey bars during the fetch. Invalid or out-of-scope task IDs redirect to closePath. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e27d25a662
commit
03c90c1fdd
3 changed files with 104 additions and 28 deletions
47
app/_components/tasks/edit-task-loader.tsx
Normal file
47
app/_components/tasks/edit-task-loader.tsx
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { redirect } from 'next/navigation'
|
||||
import { prisma } from '@/lib/prisma'
|
||||
import { productAccessFilter } from '@/lib/product-access'
|
||||
import { TaskDialog } from './task-dialog'
|
||||
|
||||
interface EditTaskLoaderProps {
|
||||
taskId: string
|
||||
userId: string
|
||||
productId: string
|
||||
closePath: string
|
||||
isDemo: boolean
|
||||
}
|
||||
|
||||
export async function EditTaskLoader({
|
||||
taskId,
|
||||
userId,
|
||||
productId,
|
||||
closePath,
|
||||
isDemo,
|
||||
}: EditTaskLoaderProps) {
|
||||
const task = await prisma.task.findFirst({
|
||||
where: {
|
||||
id: taskId,
|
||||
story: { product: productAccessFilter(userId) },
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
description: true,
|
||||
implementation_plan: true,
|
||||
priority: true,
|
||||
status: true,
|
||||
created_at: true,
|
||||
},
|
||||
})
|
||||
|
||||
if (!task) redirect(closePath)
|
||||
|
||||
return (
|
||||
<TaskDialog
|
||||
task={task}
|
||||
productId={productId}
|
||||
closePath={closePath}
|
||||
isDemo={isDemo}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue