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]>
25 lines
973 B
TypeScript
25 lines
973 B
TypeScript
import { createClient } from '@/lib/supabase/server'
|
|
import { notFound } from 'next/navigation'
|
|
import Link from 'next/link'
|
|
import { ArrowLeft } from 'lucide-react'
|
|
import KbEntryEditor from './kb-entry-editor'
|
|
import type { Tables } from '@/types/database'
|
|
|
|
export default async function OpsEntryPage({ params }: { params: Promise<{ id: string }> }) {
|
|
const { id } = await params
|
|
const supabase = await createClient()
|
|
const { data: { user } } = await supabase.auth.getUser()
|
|
if (!user) return null
|
|
|
|
const { data: member } = await supabase
|
|
.from('space_members').select('space_id, role, display_name').eq('user_id', user.id).in('status', ['current', 'unverified', 'late']).single()
|
|
if (!member) return null
|
|
|
|
const { data: entry } = await supabase
|
|
.from('knowledge_base').select('*').eq('id', id).eq('space_id', member.space_id).single()
|
|
|
|
if (!entry) notFound()
|
|
|
|
return <KbEntryEditor entry={entry} member={member as Tables<'space_members'>} />
|
|
}
|