From 766e089be0998dfc6976bc469870ed92963069af Mon Sep 17 00:00:00 2001 From: Star Richardson <67430892+alicenstar@users.noreply.github.com> Date: Wed, 18 Oct 2023 13:07:50 -0600 Subject: [PATCH] update generate add node request --- web/src/components/apps/HelmVMClusterManagement.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/src/components/apps/HelmVMClusterManagement.tsx b/web/src/components/apps/HelmVMClusterManagement.tsx index e08ee32ddc..457f92e93f 100644 --- a/web/src/components/apps/HelmVMClusterManagement.tsx +++ b/web/src/components/apps/HelmVMClusterManagement.tsx @@ -208,8 +208,9 @@ const HelmVMClusterManagement = ({ isLoading: generateAddNodeCommandLoading, // error: generateAddNodeCommandError, } = useQuery({ - queryKey: "generateAddNodeCommand", - queryFn: async () => { + queryKey: ["generateAddNodeCommand", selectedNodeTypes], + queryFn: async ({ queryKey }) => { + const [, selectedNodeTypes] = queryKey; return ( await fetch( `${process.env.API_ENDPOINT}/helmvm/generate-node-join-command`, @@ -221,12 +222,13 @@ const HelmVMClusterManagement = ({ credentials: "include", method: "POST", body: JSON.stringify({ - roles: selectedNodeTypes.join(","), + roles: selectedNodeTypes, }), } ) ).json(); }, + enabled: selectedNodeTypes.length > 0, }); // TODO: import useMutation