Skip to content

Commit

Permalink
Merge pull request #63 from MegaAntiCheat/waitingFix
Browse files Browse the repository at this point in the history
"waiting for backend" modal disappears on reconnect with backend
  • Loading branch information
megascatterbomb authored Mar 27, 2024
2 parents 6812cf6 + b44b7a1 commit 4e75a87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"scripts": {
"start": "webpack serve",
"lint": "pnpm exec eslint . && pnpm exec prettier -c \"src/**/*\"",
"lint:fix": "pnpm exec eslint --fix . && pnpm exec prettier --write \"src/**/*\"",
"lint": "pnpm exec eslint .",
"lint:fix": "pnpm exec eslint --fix .",
"build": "pnpm run lint && tailwind -i ./src/index.css -o ./src/tailwind.css && webpack --mode production",
"dev": "concurrently -k \"webpack serve --mode development\" \"tailwindcss -i ./src/index.css -o ./src/tailwind.css --watch\" \"tsc -w\"",
"prod": "concurrently -k \"webpack serve --mode production\" \"tailwindcss -i ./src/index.css -o ./src/tailwind.css --watch\" \"tsc -w\""
Expand Down
7 changes: 4 additions & 3 deletions src/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ function App() {
const { isMinimode } = useMinimode();
const [currentPage, setCurrentPage] = React.useState(PAGES.PLAYER_LIST);

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { closeModal, openModal, modalContent } = useModal();

const renderPage = () => {
Expand Down Expand Up @@ -126,7 +127,7 @@ function App() {
try {
const configured = await isBackendConfigured();
if (!configured) throw new Error('Backend not configured');
if (modalContent) closeModal();
closeModal();
return true;
} catch (e) {
console.error('Error verifying backend configuration', e);
Expand All @@ -142,7 +143,7 @@ function App() {
do {
connected = await isBackendConnected();
if (!connected) {
await new Promise((resolve) => setTimeout(resolve, 5000)); // Wait 5 seconds before retrying
await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait 1 second before retrying
}
} while (!connected);
verifyConfigured();
Expand All @@ -162,7 +163,7 @@ function App() {
if (useFakedata) return;

verificationRoutine();
const intervalId = setInterval(verificationRoutine, 5000);
const intervalId = setInterval(verificationRoutine, 1000);

return () => {
clearInterval(intervalId);
Expand Down

0 comments on commit 4e75a87

Please sign in to comment.