fix(dimentorin): For util React key + backoffice dashboard stats akurat

- For(): bungkus item dalam Fragment dgn key=idx — hilangkan warning
  'Each child in a list should have a unique key prop' di semua list backoffice
- Dashboard backoffice: fetch per_page=100 (bukan 5/1) supaya stat total
  akurat; Mentor Terdaftar dihitung dari user list role=Mentor (bukan
  unique mentor_id dalam 5 sesi pertama)
This commit is contained in:
asepharyana
2026-08-06 08:33:11 +07:00
parent 567d237651
commit b202a6210f
2 changed files with 10 additions and 6 deletions
+5 -1
View File
@@ -1,3 +1,5 @@
import { Fragment } from 'react'
export interface ForProps<T, U> {
data: readonly T[]
children: (item: T, index: number) => U | null
@@ -23,5 +25,7 @@ export function For<T, U extends React.JSX.Element>({
}: ForProps<T, U>): (U | null)[] | React.ReactNode | null {
if (!Array.isArray(data) || !data?.length) return fallback
return data.map((item, idx) => children(item, idx))
return data.map((item, idx) => (
<Fragment key={idx}>{children(item, idx)}</Fragment>
))
}