From 7c0ce2cdbbee54b7045471acda575509cdc19fab Mon Sep 17 00:00:00 2001 From: Leon Serfaty G Date: Fri, 18 Jul 2025 07:35:38 +0000 Subject: [PATCH] I see this error with the app, reported by NextJS, please fix it. The er --- src/app/admin/flows/[id]/page.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/app/admin/flows/[id]/page.tsx b/src/app/admin/flows/[id]/page.tsx index 249e643..3d7fae2 100644 --- a/src/app/admin/flows/[id]/page.tsx +++ b/src/app/admin/flows/[id]/page.tsx @@ -1,9 +1,8 @@ 'use client'; -import { useEffect, useState } from 'react'; -import { useActionState } from 'react'; -import { useRouter } from 'next/navigation'; +import { useEffect, useState, useActionState } from 'react'; +import { useRouter, useParams } from 'next/navigation'; import { getFlow, saveFlow, type Flow } from '@/lib/actions/flows'; import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; @@ -13,10 +12,6 @@ import { Button } from '@/components/ui/button'; import { useToast } from '@/hooks/use-toast'; import { Alert, AlertDescription } from '@/components/ui/alert'; -type FlowFormPageProps = { - params: { id: string }; -}; - function SubmitButton() { // useFormStatus is not used here because we are not in a form, but we can simulate the pending state // from the formAction. For a real app, you might use the pending state from useFormStatus. @@ -24,7 +19,8 @@ function SubmitButton() { return ; } -export default function FlowFormPage({ params }: FlowFormPageProps) { +export default function FlowFormPage() { + const params = useParams<{ id: string }>(); const [state, formAction] = useActionState(saveFlow, { success: false, message: '', errors: null }); const [flow, setFlow] = useState(null); const [isLoading, setIsLoading] = useState(true);