Files
hackerspace.sh/app/(app)/forms/[id]/results/page.tsx
T
Moheeb ZaraandClaude Opus 4.8 b1edb5c460 types: clear remaining tsc errors across 41 files (76→14, behavior-preserving)
Per-file type-only fixes surfaced after the Supabase client was correctly
typed. All fixes preserve runtime behavior; no any/ts-ignore/ts-expect-error.

- lib/supabase/client.ts: annotate the browser client as SupabaseClient<Database>
  (same ssr/js drift as server.ts; fixes it centrally for all callers).
- Supabase embedded-select joins whose FK metadata is missing from the
  generated types are bridged with `as unknown as <target>` + a TODO to remove
  after regenerating types/database.ts.
- setState optimistic-update variance and raw <select> enum values cast to the
  precise element/union type; .insert payload fields (Json, enums) given the
  precise column type via satisfies/field casts.
- Added narrowing guards where a value was legitimately nullable (comms channel,
  public form page) without changing the intended path.

The 14 remaining errors are confined to the four files fixed in Phase B (real
bugs + the tautological actions.test rewrite). 639 tests still green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-08-01 18:56:11 -07:00

46 lines
1.3 KiB
TypeScript

import { notFound } from 'next/navigation'
import { requireFormsManagerPage } from '@/lib/forms-guard'
import { parseFormSchema } from '@/lib/forms-schema'
import { ResultsClient } from './results-client'
export const dynamic = 'force-dynamic'
export default async function FormResultsPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params
const { supabase, member } = await requireFormsManagerPage()
const { data: form } = await supabase
.from('forms')
.select('id, slug, title, kind, schema')
.eq('id', id)
.eq('space_id', member.space_id)
.single()
if (!form) notFound()
const { data: submissions } = await supabase
.from('form_submissions')
.select('id, member_id, submitter_email, answers, form_version, created_at')
.eq('form_id', id)
.eq('space_id', member.space_id)
.order('created_at', { ascending: false })
.limit(5000)
return (
<ResultsClient
formId={form.id}
title={form.title}
fields={parseFormSchema(form.schema)}
submissions={
(submissions ?? []) as {
id: string
member_id: string | null
submitter_email: string | null
answers: Record<string, unknown> | null
form_version: number
created_at: string
}[]
}
/>
)
}