Dev Helpers

Next.js / Conference registration

Party size allocation

Dev Helpers · October 13, 2026

Allocating a party into groups is an integer problem. The remainder determines whether another group is needed and how full it will be.

Worked example

// app/register/page.tsx

export default async function PartySizeAllocation({
  searchParams,
}: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  const { size } = await searchParams;
  const n = Math.max(1, Math.min(80, Math.trunc(Number(size) || 1)));
  return (
    <p>
      Reserve {Math.ceil(n / 8)} tables of eight for {n} attendees.
    </p>
  );
}

Implementation notes

Negative party sizes and zero capacity are invalid inputs. Validate them before dividing or rounding up the number of groups.

Try it yourself

Compare an exact capacity multiple with one additional guest.

Open the Next.js example →

Editorial date October 13, 2026 · Published December 6, 2026

Related articles

Free bin volume

Free storage volume depends on consistent dimensions and units. Derive capacity and usage in the same unit before formatting a human-readable summary.

Draft preview indexing

Draft pages need deliberate indexing metadata. An indexing directive controls crawler intent, while access to unpublished material needs a separate permission check.

Locale preserving contact link

Localized links should retain the active language segment. Validate supported locales before inserting user-controlled segments into a destination.