Trying out a new pattern for errors in data fetching. Next.js is not a fan of throwing errors. Instead it recommends returning different shapes for each state. Ref: https://nextjs.org/docs/app/building-your-application/routing/error-handling#handling-expected-errors-from-server-components It requires some more detailing and a bit more refactoring in non webview part, but it is a start. This webview specific implementation should not break web.
12 lines
300 B
TypeScript
12 lines
300 B
TypeScript
import { serverClient } from "@/lib/trpc/server"
|
|
|
|
import Form from "@/components/Forms/Edit/Profile"
|
|
|
|
export default async function EditProfileSlot() {
|
|
const user = await serverClient().user.get({ mask: false })
|
|
if (!user || "error" in user) {
|
|
return null
|
|
}
|
|
return <Form user={user} />
|
|
}
|