Skip to content

Commit

Permalink
Attempt to fix the "issue" properly
Browse files Browse the repository at this point in the history
Literally can't reproduce so? might work idk
  • Loading branch information
Morilli authored and Hi-Ray committed Jan 29, 2021
1 parent e832168 commit f21c4c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/util/RiotConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ export default class RiotConnector extends EventEmitter {
* Start the watchers.
*/
start() {
this._riotClientWatch = setInterval(this._checkRiotClient.bind(this), 1000);
this._riotClientWatch ??= setInterval(this._checkRiotClient.bind(this), 1000);
if (platform() === "linux") {
return;
}
this._leagueClientWatch = setInterval(
this._leagueClientWatch ??= setInterval(
this._checkLeagueClient.bind(this),
1000
);
Expand Down
9 changes: 1 addition & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const App = (): React.ReactElement => {
const [promptAnswer, setPromptAnswer]: any = useState(null);
const [status, setStatus]: any = useState("Starting");
const [credentials, setCredentials]: any = useState();
const [isConnected, setIsConnected] = useState(false);

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down Expand Up @@ -128,11 +127,6 @@ const App = (): React.ReactElement => {
*/
ipc.on("LCUCONNECT", (event, data) => {
console.log("Connected to league client!");
// TODO: prevent
if (isConnected) {
return;
}
setIsConnected(true);
setStatus("Connected to league client!");
setGivePrompt(true);
setSwaggerJson(data);
Expand All @@ -144,12 +138,11 @@ const App = (): React.ReactElement => {
ipc.on("LCUDISCONNECT", (event, data) => {
console.log("League client disconnected; attempting to reconnect");
setStatus("League client disconnected; attempting to reconnect");
setIsConnected(false);
setGivePrompt(false);
setPromptAnswer(null);
setSwaggerJson("");
});
});
}, []);

return (
<>
Expand Down

0 comments on commit f21c4c3

Please sign in to comment.