File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
app/(use-page-wrapper)/getting-started/[[...step]]
modules/getting-started/[[...step]] Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change
1
+ import { createRouterCaller } from "app/_trpc/context" ;
1
2
import type { PageProps as ServerPageProps } from "app/_types" ;
2
3
import { _generateMetadata } from "app/_utils" ;
3
4
import { cookies , headers } from "next/headers" ;
@@ -7,6 +8,7 @@ import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
7
8
import { APP_NAME } from "@calcom/lib/constants" ;
8
9
import { UserRepository } from "@calcom/lib/server/repository/user" ;
9
10
import prisma from "@calcom/prisma" ;
11
+ import { meRouter } from "@calcom/trpc/server/routers/viewer/me/_router" ;
10
12
11
13
import { buildLegacyRequest } from "@lib/buildLegacyCtx" ;
12
14
@@ -32,15 +34,20 @@ const ServerPage = async ({ params, searchParams }: ServerPageProps) => {
32
34
}
33
35
34
36
const userRepo = new UserRepository ( prisma ) ;
35
- const user = await userRepo . findUserTeams ( {
36
- id : session . user . id ,
37
- } ) ;
37
+ const meCaller = await createRouterCaller ( meRouter ) ;
38
38
39
- if ( ! user ) {
39
+ const [ userTeams , user ] = await Promise . all ( [
40
+ userRepo . findUserTeams ( {
41
+ id : session . user . id ,
42
+ } ) ,
43
+ meCaller . get ( ) ,
44
+ ] ) ;
45
+
46
+ if ( ! userTeams || ! user ) {
40
47
return redirect ( "/auth/login" ) ;
41
48
}
42
49
43
- return < Page hasPendingInvites = { ! ! user . teams . find ( ( team ) => team . accepted === false ) } /> ;
50
+ return < Page user = { user } hasPendingInvites = { ! ! userTeams . teams . find ( ( team ) => team . accepted === false ) } /> ;
44
51
} ;
45
52
46
53
export default ServerPage ;
Original file line number Diff line number Diff line change @@ -10,8 +10,7 @@ import { z } from "zod";
10
10
import { APP_NAME } from "@calcom/lib/constants" ;
11
11
import { useLocale } from "@calcom/lib/hooks/useLocale" ;
12
12
import { useParamsWithFallback } from "@calcom/lib/hooks/useParamsWithFallback" ;
13
- import { trpc } from "@calcom/trpc" ;
14
- import type { inferSSRProps } from "@calcom/types/inferSSRProps" ;
13
+ import type { RouterOutputs } from "@calcom/trpc/react" ;
15
14
import classNames from "@calcom/ui/classNames" ;
16
15
import { Button } from "@calcom/ui/components/button" ;
17
16
import { StepCard } from "@calcom/ui/components/card" ;
@@ -85,13 +84,14 @@ const stepRouteSchema = z.object({
85
84
86
85
type PageProps = {
87
86
hasPendingInvites : boolean ;
87
+ user : RouterOutputs [ "viewer" ] [ "me" ] [ "get" ] ;
88
88
} ;
89
+
89
90
const OnboardingPage = ( props : PageProps ) => {
90
91
const pathname = usePathname ( ) ;
91
92
const params = useParamsWithFallback ( ) ;
92
-
93
+ const user = props . user ;
93
94
const router = useRouter ( ) ;
94
- const [ user ] = trpc . viewer . me . get . useSuspenseQuery ( ) ;
95
95
const { t } = useLocale ( ) ;
96
96
const [ isNextStepLoading , startTransition ] = useTransition ( ) ;
97
97
You can’t perform that action at this time.
0 commit comments