import type { JSX } from "react"
import { getStudentSelections } from "@/modules/elective/data-access-selections"
import { StudentMySelectionsSection } from "@/modules/elective/components/student-selection-view"

/**
 * 我的选课 - 异步 RSC loader
 * 独立 Suspense 边界，可流式渲染
 * 数据获取通过 React cache() 自动去重
 */
export async function MySelectionsLoader({
  studentId,
}: {
  studentId: string
}): Promise<JSX.Element> {
  const mySelections = await getStudentSelections(studentId)
  return <StudentMySelectionsSection mySelections={mySelections} />
}
