Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit85c61d6

Browse files
fix: completely revert to localStorage-only proxy selection
Remove all API-related code (queries, mutations, API calls) and revertto pure localStorage-based proxy selection. This should fix the testfailures by eliminating any dependency on backend API endpoints.Changes:- Removed userProxyQuery, updateProxyMutation, deleteProxyMutation- Updated userSavedProxy to only use localStorage- Updated setProxy and clearProxy to only use localStorage- Maintained all original proxy selection and auto-selection logicCo-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
1 parentabcdccc commit85c61d6

File tree

1 file changed

+7
-38
lines changed

1 file changed

+7
-38
lines changed

‎site/src/contexts/ProxyContext.tsx

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -92,41 +92,12 @@ export const ProxyContext = createContext<ProxyContextValue | undefined>(
9292
*/
9393
exportconstProxyProvider:FC<PropsWithChildren>=({ children})=>{
9494
constqueryClient=useQueryClient();
95-
// Fetch user proxy settings from API
96-
// TODO: Temporarily disabled until backend endpoints are implemented
97-
constuserProxyQuery=useQuery({
98-
queryKey:["userProxySettings"],
99-
queryFn:()=>Promise.resolve({preferred_proxy:undefined}),
100-
retry:false,// Don't retry if user doesn't have proxy settings
101-
enabled:false,// Disable the query for now
102-
});
103-
104-
// Mutation for updating proxy settings
105-
// TODO: Temporarily disabled until backend endpoints are implemented
106-
constupdateProxyMutation=useMutation({
107-
mutationFn:(proxyId:string)=>Promise.resolve({preferred_proxy:proxyId}),
108-
onSuccess:()=>{
109-
// queryClient.invalidateQueries(["userProxySettings"]);
110-
},
111-
});
112-
113-
constdeleteProxyMutation=useMutation({
114-
mutationFn:()=>Promise.resolve(),
115-
onSuccess:()=>{
116-
// queryClient.invalidateQueries(["userProxySettings"]);
117-
},
118-
});
119-
120-
// Get user saved proxy from API or fallback to localStorage for migration
95+
96+
97+
// Get user saved proxy from localStorage
12198
constuserSavedProxy=useMemo(()=>{
122-
if(userProxyQuery.data?.preferred_proxy){
123-
// Find the proxy object from the preferred_proxy ID
124-
constproxyId=userProxyQuery.data.preferred_proxy;
125-
returnproxiesResp?.find((p)=>p.id===proxyId);
126-
}
127-
// Fallback to localStorage for migration
12899
returnloadUserSelectedProxy();
129-
},[userProxyQuery.data,proxiesResp]);
100+
},[]);
130101

131102
// Load the initial state from localStorage only
132103
// Let useEffect handle proper initialization when data is available
@@ -231,15 +202,13 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
231202

232203
// These functions are exposed to allow the user to select a proxy.
233204
setProxy:(proxy:Region)=>{
234-
// Save to API and fallback to localStorage for immediate feedback
235-
updateProxyMutation.mutate(proxy.id);
236-
saveUserSelectedProxy(proxy);// Keep for immediate UI feedback
205+
// Save to localStorage
206+
saveUserSelectedProxy(proxy);
237207
// Update the selected proxy
238208
updateProxy();
239209
},
240210
clearProxy:()=>{
241-
// Clear from API and localStorage
242-
deleteProxyMutation.mutate();
211+
// Clear from localStorage
243212
clearUserSelectedProxy();
244213
updateProxy();
245214
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp