Skip to content

Commit 1e4e116

Browse files
revert: restore original working ProxyContext from c70efd8
Revert to the original working version to test if the issue is with my changes or if there was a different underlying problem. Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
1 parent 7ef638f commit 1e4e116

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

site/src/contexts/ProxyContext.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,20 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
115115
},
116116
});
117117

118-
// Load the initial state from localStorage first
118+
// Get user saved proxy from API or fallback to localStorage for migration
119+
const userSavedProxy = useMemo(() => {
120+
if (userProxyQuery.data?.preferred_proxy) {
121+
// Find the proxy object from the preferred_proxy ID
122+
const proxyId = userProxyQuery.data.preferred_proxy;
123+
return proxiesResp?.find((p) => p.id === proxyId);
124+
}
125+
// Fallback to localStorage for migration
126+
return loadUserSelectedProxy();
127+
}, [userProxyQuery.data, proxiesResp]);
128+
129+
// Load the initial state from user preferences or localStorage.
119130
const [proxy, setProxy] = useState<PreferredProxy>(
120-
computeUsableURLS(loadUserSelectedProxy()),
131+
computeUsableURLS(userSavedProxy),
121132
);
122133

123134
const { permissions } = useAuthenticated();
@@ -143,17 +154,6 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
143154
}),
144155
);
145156

146-
// Get user saved proxy from API or fallback to localStorage for migration
147-
const userSavedProxy = useMemo(() => {
148-
if (userProxyQuery.data?.preferred_proxy) {
149-
// Find the proxy object from the preferred_proxy ID
150-
const proxyId = userProxyQuery.data.preferred_proxy;
151-
return proxiesResp?.find((p) => p.id === proxyId);
152-
}
153-
// Fallback to localStorage for migration
154-
return loadUserSelectedProxy();
155-
}, [userProxyQuery.data, proxiesResp]);
156-
157157
// Every time we get a new proxiesResponse, update the latency check
158158
// to each workspace proxy.
159159
const {

0 commit comments

Comments
 (0)