Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
chore: do not show loading messages during setup
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Jul 3, 2024
1 parent 2a4e761 commit 93e26d3
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions frontend/src/screens/setup/SetupFinish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { toast } from "src/components/ui/use-toast";
import { useCSRF } from "src/hooks/useCSRF";
import { useInfo } from "src/hooks/useInfo";
import useSetupStore from "src/state/SetupStore";
import { SetupNodeInfo, startupMessages as messages } from "src/types";
import { SetupNodeInfo } from "src/types";
import { asyncTimeout } from "src/utils/asyncTimeout";
import { handleRequestError } from "src/utils/handleRequestError";
import { request } from "src/utils/request";
Expand All @@ -20,9 +20,6 @@ export function SetupFinish() {
const { data: info } = useInfo(true);
const { data: csrf } = useCSRF();
const [connectionError, setConnectionError] = React.useState(false);
const [loadingMessage, setLoadingMessage] = React.useState(
"Setting up your Hub..."
);
const hasFetchedRef = React.useRef(false);

const defaultOptions = {
Expand All @@ -45,17 +42,6 @@ export function SetupFinish() {
const succeeded = await finishSetup(csrf, nodeInfo, unlockPassword);
if (succeeded) {
// only setup call is successful as start is async
let messageIndex = 1;
const intervalId = setInterval(() => {
// we don't check for info.running as HomeRedirect takes care of it
if (messageIndex < messages.length) {
setLoadingMessage(messages[messageIndex]);
messageIndex++;
} else {
clearInterval(intervalId);
}
}, 5000);

await asyncTimeout(180000); // wait for 3 minutes
if (!info?.running) {
setConnectionError(true);
Expand All @@ -64,7 +50,7 @@ export function SetupFinish() {
setConnectionError(true);
}
})();
}, [csrf, nodeInfo, info, navigate, unlockPassword, loadingMessage]);
}, [csrf, nodeInfo, info, navigate, unlockPassword]);

if (connectionError) {
return (
Expand All @@ -91,7 +77,7 @@ export function SetupFinish() {
<div className="flex flex-col gap-5 justify-center text-center">
<Lottie options={defaultOptions} height={400} width={400} />
<h1 className="font-semibold text-lg font-headline">
{loadingMessage}
Setting up your Hub...
</h1>
</div>
</Container>
Expand Down

0 comments on commit 93e26d3

Please sign in to comment.