import { getUsersList } from '@/lib/admin/list';
import { UsersTable } from './users-table';

export const dynamic = 'force-dynamic';
export const revalidate = 0;

const PER_PAGE = 25;

export default async function AdminUsersPage() {
  // Initial load runs on the server (the admin session is already validated by
  // the admin layout's requireAdmin()), so the first paint never races the
  // client session-cookie refresh.
  const { users, total } = await getUsersList({
    page: 1,
    perPage: PER_PAGE,
    search: '',
  });

  return <UsersTable initialUsers={users} initialTotal={total} />;
}
