diff --git a/src/app/(frontend)/abaixo-assinado/[id]/page.tsx b/src/app/(frontend)/abaixo-assinado/[id]/page.tsx index 20efe4be..06fa5188 100644 --- a/src/app/(frontend)/abaixo-assinado/[id]/page.tsx +++ b/src/app/(frontend)/abaixo-assinado/[id]/page.tsx @@ -237,7 +237,11 @@ export default async function Page({ params }: { params: Promise<{ id: string }>
diff --git a/src/components/PetitionForm.tsx b/src/components/PetitionForm.tsx index 6d746ef2..bf39f619 100644 --- a/src/components/PetitionForm.tsx +++ b/src/components/PetitionForm.tsx @@ -11,7 +11,6 @@ import { } from '@/components/ui/field' import { trackMetaLead } from '@/lib/facebookPixel' import { petitionFormSchema, type PetitionFormInput } from '@/lib/schemas/petition-form' -import { Petition } from '@/payload-types' import { zodResolver } from '@hookform/resolvers/zod' import { useState, useTransition } from 'react' import { FormProvider, useForm, type SubmitHandler } from 'react-hook-form' @@ -26,9 +25,18 @@ import { StateSelect } from './StateSelect' import { Button } from './ui/button' import { Textarea } from './ui/textarea' +// View model — the server page selects only the fields this form renders, so +// the full petition document (body richText, consent relation, tracking, +// timestamps) never crosses the RSC wire into this client component. +type PetitionFormPetition = { + id: string + title: string + form: { title?: string | null; subtitle?: string | null } +} + interface PetitionFormProps { id: string - petition: Petition + petition: PetitionFormPetition consentHTML: string facebookPixelId?: string } diff --git a/tests/unit/petitionLead.unit.spec.tsx b/tests/unit/petitionLead.unit.spec.tsx index ac8f9bd8..9bc6ad20 100644 --- a/tests/unit/petitionLead.unit.spec.tsx +++ b/tests/unit/petitionLead.unit.spec.tsx @@ -31,7 +31,7 @@ vi.mock('@/lib/facebookPixel', async (importOriginal) => { const PIXEL_ID = '123456789012345' const petition = { - id: 1, + id: '1', title: 'Pela manutenção do Hospital do Subúrbio', form: { title: 'Assine a petição', subtitle: '' }, } as unknown as Petition