File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/components/billing/pricing-modal Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import type { PricingPlanInterval, PricingType } from "@/prisma/enums";
12
12
import { api } from "@/trpc/react" ;
13
13
import type { TypeZodStripePortalMutationSchema } from "@/trpc/routers/billing-router/schema" ;
14
14
import type { RouterOutputs } from "@/trpc/shared" ;
15
- import { useRouter , useSearchParams } from "next/navigation" ;
15
+ import { usePathname , useRouter , useSearchParams } from "next/navigation" ;
16
16
import { useEffect , useState } from "react" ;
17
17
import { EmptyPlans } from "./empty-plans" ;
18
18
import { PricingButton } from "./pricing-button" ;
@@ -178,19 +178,24 @@ export function PricingModal({ products, subscription }: PricingModalProps) {
178
178
const [ open , setOpen ] = useState ( false ) ;
179
179
const router = useRouter ( ) ;
180
180
const searchParams = useSearchParams ( ) ;
181
+ const path = usePathname ( ) ;
181
182
const upgrade = searchParams . get ( "upgrade" ) ;
183
+
182
184
useEffect ( ( ) => {
183
185
const isOpen = upgrade === "true" ;
184
186
if ( isOpen ) {
185
187
setOpen ( true ) ;
186
188
}
189
+ return ( ) => {
190
+ setOpen ( false ) ;
191
+ } ;
187
192
} , [ upgrade ] ) ;
188
193
189
194
return (
190
195
< Dialog
191
196
open = { open }
192
197
onOpenChange = { ( ) => {
193
- router . back ( ) ;
198
+ router . push ( path ) ;
194
199
} }
195
200
>
196
201
< DialogContent className = "max-w-[95vw]" >
You can’t perform that action at this time.
0 commit comments