diff --git a/src/hooks/useFaultTrees.tsx b/src/hooks/useFaultTrees.tsx index 4b111af1..f79ffd4e 100644 --- a/src/hooks/useFaultTrees.tsx +++ b/src/hooks/useFaultTrees.tsx @@ -46,7 +46,7 @@ export const FaultTreesProvider = ({ children }) => { .create(faultTree) .then((value) => { showSnackbar("Fault Tree created", SnackbarType.SUCCESS); - _setFaultTrees([..._faultTrees, value]); + faultTreeService.findAll().then((result) => _setFaultTrees(result)); }) .catch((reason) => showSnackbar(reason, SnackbarType.ERROR)); }; diff --git a/src/hooks/useSystems.tsx b/src/hooks/useSystems.tsx index 04cc4edc..f29622a4 100644 --- a/src/hooks/useSystems.tsx +++ b/src/hooks/useSystems.tsx @@ -51,7 +51,7 @@ export const SystemsProvider = ({ children }: ChildrenProps) => { .create(system) .then((value) => { showSnackbar("System created", SnackbarType.SUCCESS); - _setSystems([..._systems, value]); + setShouldFetchSystems(true); }) .catch((reason) => showSnackbar(reason, SnackbarType.ERROR)); };