Skip to content

Commit

Permalink
Merge pull request #1903 from Gkrumbach07/fixResetData
Browse files Browse the repository at this point in the history
refresh accelerators after reset
  • Loading branch information
openshift-ci[bot] authored Oct 4, 2023
2 parents 2da86b8 + 2969ea8 commit 00a6200
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frontend/src/utilities/useAcceleratorState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

0 comments on commit 00a6200

Please sign in to comment.