@@ -27,7 +27,12 @@ import AddEmailForm from "../components/UserProfile/AddEmailForm";
27
27
import UserEmailList , {
28
28
query as userEmailListQuery ,
29
29
} from "../components/UserProfile/UserEmailList" ;
30
- import { graphql } from "../gql" ;
30
+ import {
31
+ CONFIG_FRAGMENT as PLAN_MANAGEMENT_CONFIG_FRAGMENT ,
32
+ query as planManagementQuery ,
33
+ } from "./_account.plan.index" ;
34
+
35
+ import { graphql , useFragment } from "../gql" ;
31
36
import { graphqlRequest } from "../graphql" ;
32
37
33
38
const QUERY = graphql ( /* GraphQL */ `
@@ -96,7 +101,7 @@ const actionSchema = v.variant("action", [
96
101
export const Route = createFileRoute ( "/_account/" ) ( {
97
102
validateSearch : actionSchema ,
98
103
99
- beforeLoad ( { search } ) {
104
+ async beforeLoad ( { search, context } ) {
100
105
switch ( search . action ) {
101
106
case "profile" :
102
107
case "org.matrix.profile" :
@@ -129,10 +134,17 @@ export const Route = createFileRoute("/_account/")({
129
134
to : "/reset-cross-signing" ,
130
135
search : { deepLink : true } ,
131
136
} ) ;
132
- case "org.matrix.plan_management" :
137
+ case "org.matrix.plan_management" : {
138
+ const { siteConfig } =
139
+ await context . queryClient . ensureQueryData ( planManagementQuery ) ;
140
+ const { planManagementIframeUri } = useFragment (
141
+ PLAN_MANAGEMENT_CONFIG_FRAGMENT ,
142
+ siteConfig ,
143
+ ) ;
133
144
throw redirect ( {
134
- to : "/plan" ,
145
+ to : planManagementIframeUri ? "/plan" : "/ ",
135
146
} ) ;
147
+ }
136
148
}
137
149
} ,
138
150
0 commit comments