@@ -56,6 +56,8 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
56
56
setProxy ( preferred )
57
57
}
58
58
59
+ const dashboard = useDashboard ( )
60
+ const experimentEnabled = ! dashboard ?. experiments . includes ( "moons" )
59
61
const queryKey = [ "get-regions" ]
60
62
const { error : regionsError , isLoading : regionsLoading } = useQuery ( {
61
63
queryKey,
@@ -66,13 +68,13 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
66
68
onSuccess : ( data ) => {
67
69
setAndSaveProxy ( data . regions , proxy . selectedProxy )
68
70
} ,
71
+ enabled : experimentEnabled ,
69
72
} )
70
73
71
74
// ******************************* //
72
75
// ** This code can be removed **
73
76
// ** when the experimental is **
74
77
// ** dropped ** //
75
- const dashboard = useDashboard ( )
76
78
const appHostQueryKey = [ "get-application-host" ]
77
79
const {
78
80
data : applicationHostResult ,
@@ -81,11 +83,12 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
81
83
} = useQuery ( {
82
84
queryKey : appHostQueryKey ,
83
85
queryFn : getApplicationsHost ,
86
+ enabled : ! experimentEnabled ,
84
87
} )
85
88
86
89
// If the experiment is disabled, then make the setState do a noop.
87
90
// This preserves an empty state, which is the default behavior.
88
- if ( ! dashboard ?. experiments . includes ( "moons" ) ) {
91
+ if ( ! experimentEnabled ) {
89
92
const value = getPreferredProxy ( [ ] )
90
93
91
94
return (
0 commit comments