diff --git a/pkgs/clan-app/ui/src/workflows/InstallMachine/InstallMachine.tsx b/pkgs/clan-app/ui/src/workflows/InstallMachine/InstallMachine.tsx index 971fc5fc6..adf6e8043 100644 --- a/pkgs/clan-app/ui/src/workflows/InstallMachine/InstallMachine.tsx +++ b/pkgs/clan-app/ui/src/workflows/InstallMachine/InstallMachine.tsx @@ -13,6 +13,7 @@ import { installSteps } from "./steps/installSteps"; import { ApiCall } from "@/src/hooks/api"; import cx from "classnames"; +import { useClanContext } from "@/src/routes/Clan/Clan"; interface InstallStepperProps { onDone: () => void; @@ -66,6 +67,8 @@ export interface InstallStoreType { export type PromptValues = Record>; export const InstallModal = (props: InstallModalProps) => { + const ctx = useClanContext(); + const stepper = createStepper( { steps, @@ -107,22 +110,27 @@ export const InstallModal = (props: InstallModalProps) => { } }; + const onClose = async () => { + // refresh some queries + await ctx.machinesQuery.refetch(); + await ctx.serviceInstancesQuery.refetch(); + + props.onClose?.(); + }; + return ( { - console.log("Install modal closed"); - props.onClose?.(); - }} + onClose={onClose} open={props.open} // @ts-expect-error some steps might not have metaHeader={stepper.currentStep()?.title ? : undefined} // @ts-expect-error some steps might not have disablePadding={stepper.currentStep()?.isSplash} > - props.onClose?.()} /> + ); diff --git a/pkgs/clan-app/ui/src/workflows/InstallMachine/UpdateMachine.tsx b/pkgs/clan-app/ui/src/workflows/InstallMachine/UpdateMachine.tsx index d46ddf22a..47ee84f33 100644 --- a/pkgs/clan-app/ui/src/workflows/InstallMachine/UpdateMachine.tsx +++ b/pkgs/clan-app/ui/src/workflows/InstallMachine/UpdateMachine.tsx @@ -19,6 +19,7 @@ import { LoadingBar } from "@/src/components/LoadingBar/LoadingBar"; import { useApiClient } from "@/src/hooks/ApiClient"; import { useClanURI } from "@/src/hooks/clan"; import { AlertProps } from "@/src/components/Alert/Alert"; +import { useClanContext } from "@/src/routes/Clan/Clan"; // TODO: Deduplicate interface UpdateStepperProps { @@ -237,6 +238,8 @@ export type UpdateSteps = typeof steps; export type PromptValues = Record>; export const UpdateModal = (props: UpdateModalProps) => { + const ctx = useClanContext(); + const stepper = createStepper( { steps, @@ -281,22 +284,27 @@ export const UpdateModal = (props: UpdateModalProps) => { } }; + const onClose = async () => { + // refresh some queries + await ctx.machinesQuery.refetch(); + await ctx.serviceInstancesQuery.refetch(); + + props.onClose?.(); + }; + return ( { - console.log("Update modal closed"); - props.onClose?.(); - }} + onClose={onClose} open={props.open} // @ts-expect-error some steps might not have metaHeader={stepper.currentStep()?.title ? : undefined} // @ts-expect-error some steps might not have disablePadding={stepper.currentStep()?.isSplash} > - props.onClose?.()} /> + );