From 2969ea84b8d36d4964a5c1ac4d6a277de4f61123 Mon Sep 17 00:00:00 2001 From: Gage Krumbach Date: Tue, 3 Oct 2023 15:31:17 -0500 Subject: [PATCH] refresh accelerators after reset --- frontend/src/utilities/useAcceleratorState.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/utilities/useAcceleratorState.ts b/frontend/src/utilities/useAcceleratorState.ts index 83a55cce42..08f9f0175d 100644 --- a/frontend/src/utilities/useAcceleratorState.ts +++ b/frontend/src/utilities/useAcceleratorState.ts @@ -31,7 +31,7 @@ const useAcceleratorState = ( }); const { dashboardNamespace } = useDashboardNamespace(); - const [accelerators, loaded, loadError] = useAccelerators(dashboardNamespace); + const [accelerators, loaded, loadError, refresh] = useAccelerators(dashboardNamespace); React.useEffect(() => { if (loaded && !loadError) { @@ -124,7 +124,12 @@ const useAcceleratorState = ( } }, [accelerators, loaded, loadError, resources, tolerations, existingAcceleratorName, setData]); - return [acceleratorState, setData, resetData]; + const resetDataAndRefresh = React.useCallback(() => { + resetData(); + refresh(); + }, [refresh, resetData]); + + return [acceleratorState, setData, resetDataAndRefresh]; }; export default useAcceleratorState;