add error boundry
This commit is contained in:
@@ -132,7 +132,7 @@ def enroll(
|
||||
'sk': now_,
|
||||
'enrolled': list(map(fmt, now_out)) if now_out else None,
|
||||
'scheduled': list(map(fmt, later_out)) if later_out else None,
|
||||
'ttl': ttl(start_dt=now_, days=30 * 6),
|
||||
'ttl': ttl(start_dt=now_, days=30 * 3),
|
||||
'created_by': {
|
||||
'id': created_by.id,
|
||||
'name': created_by.name,
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
} from 'lucide-react'
|
||||
import { Link } from 'react-router'
|
||||
import { Suspense } from 'react'
|
||||
import { ErrorBoundary } from 'react-error-boundary'
|
||||
|
||||
import {
|
||||
Card,
|
||||
@@ -77,7 +78,7 @@ export default function Route({ loaderData: { data } }: Route.ComponentProps) {
|
||||
</BreadcrumbList>
|
||||
</Breadcrumb>
|
||||
|
||||
<Await resolve={data}>
|
||||
<Await resolve={data} errorElement={<div>Algo deu errado</div>}>
|
||||
{({ enrolled, scheduled, sk, created_by }) => {
|
||||
const succeed = enrolled.filter(
|
||||
({ status }) => status === 'success'
|
||||
|
||||
@@ -37,7 +37,6 @@ export async function loader({ params, request, context }: Route.LoaderArgs) {
|
||||
})
|
||||
|
||||
if (!r.ok) {
|
||||
console.log(r.status)
|
||||
throw new Response(null, { status: r.status })
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"meilisearch-helper": "github:sergiors/meilisearch-helper",
|
||||
"react": "^19.2.1",
|
||||
"react-dom": "^19.2.1",
|
||||
"react-error-boundary": "^6.0.0",
|
||||
"react-router": "^7.10.1",
|
||||
"unique-names-generator": "^4.7.1",
|
||||
"zod": "^4.1.13"
|
||||
|
||||
13
package-lock.json
generated
13
package-lock.json
generated
@@ -40,6 +40,7 @@
|
||||
"meilisearch-helper": "github:sergiors/meilisearch-helper",
|
||||
"react": "^19.2.1",
|
||||
"react-dom": "^19.2.1",
|
||||
"react-error-boundary": "^6.0.0",
|
||||
"react-router": "^7.10.1",
|
||||
"unique-names-generator": "^4.7.1",
|
||||
"zod": "^4.1.13"
|
||||
@@ -5792,6 +5793,18 @@
|
||||
"react": "^19.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/react-error-boundary": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-6.0.0.tgz",
|
||||
"integrity": "sha512-gdlJjD7NWr0IfkPlaREN2d9uUZUlksrfOx7SX62VRerwXbMY6ftGCIZua1VG1aXFNOimhISsTq+Owp725b9SiA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.13.1"
|
||||
}
|
||||
},
|
||||
"node_modules/react-fast-compare": {
|
||||
"version": "3.2.2",
|
||||
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz",
|
||||
|
||||
Reference in New Issue
Block a user