diff --git a/src/routes/AppProfile/LaunchButton.tsx b/src/routes/AppProfile/LaunchButton.tsx index 823d45a..cb77703 100644 --- a/src/routes/AppProfile/LaunchButton.tsx +++ b/src/routes/AppProfile/LaunchButton.tsx @@ -5,6 +5,7 @@ import { ProfileFolderState, ProfileState } from "@app/hooks/useProfileState"; import { localize } from "@app/utils/localized"; import { usePayload } from "@app/tasks/payload"; import PayloadProgress from "@app/components/PayloadProgress"; +import { useEffect, useRef, useState } from "react"; interface Props { profileState: ProfileState @@ -22,11 +23,20 @@ export function LaunchButton({ profileState }: Props) { const payload = usePayload(currentTask?.taskUUID); + const [launching, setLaunching] = useState(false); + const launchTimeoutRef = useRef(); + + // Make sure to reset the launching status when the profile changes + useEffect(() => { + setLaunching(false); + clearTimeout(launchTimeoutRef.current); + }, [activeProfile]); + const profile = activeProfile.profile; // Loading button - if (loading) { - return ; } @@ -69,7 +79,16 @@ export function LaunchButton({ profileState }: Props) { // Launch/up-to-date button if (folderState === ProfileFolderState.UpToDate) { - return