1
0
Fork 0
mirror of https://codeberg.org/MarkusThielker/next-ory.git synced 2025-04-18 00:21:18 +00:00

Update ErrorPage to use Suspense for consistent error handling.

Read: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
This commit is contained in:
dotX12 2025-01-26 16:57:46 +03:00
parent 5c01f1a730
commit 015f04b76a

View file

@ -1,6 +1,6 @@
'use client'; 'use client';
import React, { useEffect, useState } from 'react'; import React, {Suspense, useEffect, useState} from 'react';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { FlowError } from '@ory/client'; import { FlowError } from '@ory/client';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
@ -9,7 +9,15 @@ import { useRouter, useSearchParams } from 'next/navigation';
import Link from 'next/link'; import Link from 'next/link';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
export default function Error() { export default function ErrorPage() {
return (
<Suspense>
<Error />
</Suspense>
)
}
function Error() {
const [error, setError] = useState<FlowError>(); const [error, setError] = useState<FlowError>();
@ -62,10 +70,10 @@ export default function Error() {
</CardContent> </CardContent>
</Card> </Card>
<Button asChild> <Button asChild>
<Link href="/" className="inline-flex space-x-2" passHref> <Link href="/" className="inline-flex space-x-2" passHref>
Go back Go back
</Link> </Link>
</Button> </Button>
</> </>
); );
} }