I see this error with the app, reported by NextJS, please fix it. The er
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
|
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState, useActionState } from 'react';
|
||||||
import { useActionState } from 'react';
|
import { useRouter, useParams } from 'next/navigation';
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
import { getFlow, saveFlow, type Flow } from '@/lib/actions/flows';
|
import { getFlow, saveFlow, type Flow } from '@/lib/actions/flows';
|
||||||
import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from '@/components/ui/card';
|
import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from '@/components/ui/card';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
@@ -13,10 +12,6 @@ import { Button } from '@/components/ui/button';
|
|||||||
import { useToast } from '@/hooks/use-toast';
|
import { useToast } from '@/hooks/use-toast';
|
||||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||||
|
|
||||||
type FlowFormPageProps = {
|
|
||||||
params: { id: string };
|
|
||||||
};
|
|
||||||
|
|
||||||
function SubmitButton() {
|
function SubmitButton() {
|
||||||
// useFormStatus is not used here because we are not in a form, but we can simulate the pending state
|
// 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.
|
// from the formAction. For a real app, you might use the pending state from useFormStatus.
|
||||||
@@ -24,7 +19,8 @@ function SubmitButton() {
|
|||||||
return <Button type="submit">Save Changes</Button>;
|
return <Button type="submit">Save Changes</Button>;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 [state, formAction] = useActionState(saveFlow, { success: false, message: '', errors: null });
|
||||||
const [flow, setFlow] = useState<Flow | null>(null);
|
const [flow, setFlow] = useState<Flow | null>(null);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user