fix: 状态问题

This commit is contained in:
song_xiao_lin
2024-05-09 14:52:07 +08:00
parent 514006fef5
commit f2d360fae0
+6 -1
View File
@@ -56,7 +56,12 @@ export const Contro: React.FC<ControProps> = () => {
const findPort = (port: number, max: number) => {
const ws = new WebSocket(`ws://127.0.0.1:${port}`);
ws.onclose = (e: CloseEvent) => {
if (enginePortRef.current) return
if (enginePortRef.current) {
setConnected(false);
setAutoFindFailedReason("Yakit WebSocket Controller Connect Fail");
localStorage.setItem("yakit-connect", "");
return
}
if (e.reason !== `FoundYakitWebSocketController` && port + 1 <= max) {
setTimeout(() => findPort(port + 1, max), 200);
}