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

Commitd4bab5e

Browse files
fix: temporarily disable new proxy API calls until backend is implemented
The frontend tests are failing because the new proxy settings API endpoints(/api/v2/users/me/proxy) don't exist yet on the backend. Temporarily disablethese API calls to fix the tests while the backend endpoints are implemented.Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
1 parent1e4e116 commitd4bab5e

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

‎site/src/contexts/ProxyContext.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,25 +93,27 @@ export const ProxyContext = createContext<ProxyContextValue | undefined>(
9393
exportconstProxyProvider:FC<PropsWithChildren>=({ children})=>{
9494
constqueryClient=useQueryClient();
9595
// Fetch user proxy settings from API
96+
// TODO: Temporarily disabled until backend endpoints are implemented
9697
constuserProxyQuery=useQuery({
9798
queryKey:["userProxySettings"],
98-
queryFn:()=>API.getProxySettings(),
99+
queryFn:()=>Promise.resolve({preferred_proxy:undefined}),
99100
retry:false,// Don't retry if user doesn't have proxy settings
101+
enabled:false,// Disable the query for now
100102
});
101103

102104
// Mutation for updating proxy settings
105+
// TODO: Temporarily disabled until backend endpoints are implemented
103106
constupdateProxyMutation=useMutation({
104-
mutationFn:(proxyId:string)=>
105-
API.updateProxySettings({preferred_proxy:proxyId}),
107+
mutationFn:(proxyId:string)=>Promise.resolve({preferred_proxy:proxyId}),
106108
onSuccess:()=>{
107-
queryClient.invalidateQueries(["userProxySettings"]);
109+
//queryClient.invalidateQueries(["userProxySettings"]);
108110
},
109111
});
110112

111113
constdeleteProxyMutation=useMutation({
112-
mutationFn:()=>API.deleteProxySettings(),
114+
mutationFn:()=>Promise.resolve(),
113115
onSuccess:()=>{
114-
queryClient.invalidateQueries(["userProxySettings"]);
116+
//queryClient.invalidateQueries(["userProxySettings"]);
115117
},
116118
});
117119

@@ -127,9 +129,15 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
127129
},[userProxyQuery.data,proxiesResp]);
128130

129131
// Load the initial state from user preferences or localStorage.
130-
const[proxy,setProxy]=useState<PreferredProxy>(
131-
computeUsableURLS(userSavedProxy),
132-
);
132+
// Use safe initialization to avoid temporal dead zone with userSavedProxy
133+
const[proxy,setProxy]=useState<PreferredProxy>(()=>{
134+
// Only use userSavedProxy if proxiesResp is available
135+
if(proxiesResp&&userSavedProxy){
136+
returncomputeUsableURLS(userSavedProxy);
137+
}
138+
// Safe fallback - let useEffect handle proper initialization
139+
returncomputeUsableURLS(undefined);
140+
});
133141

134142
const{ permissions}=useAuthenticated();
135143
const{ metadata}=useEmbeddedMetadata();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp