refetches smart inventory after edit save

This commit is contained in:
Alex Corey
2021-06-14 17:15:55 -04:00
committed by Shane McDonald
parent 8d99f79de4
commit 736cd4df36

View File

@@ -28,25 +28,22 @@ function SmartInventory({ setBreadcrumb }) {
const match = useRouteMatch('/inventories/smart_inventory/:id'); const match = useRouteMatch('/inventories/smart_inventory/:id');
const { const {
result: { inventory }, result: inventory,
error: contentError, error: contentError,
isLoading: hasContentLoading, isLoading: hasContentLoading,
request: fetchInventory, request: fetchInventory,
} = useRequest( } = useRequest(
useCallback(async () => { useCallback(async () => {
const { data } = await InventoriesAPI.readDetail(match.params.id); const { data } = await InventoriesAPI.readDetail(match.params.id);
return { return data;
inventory: data,
};
}, [match.params.id]), }, [match.params.id]),
{
inventory: null, null
}
); );
useEffect(() => { useEffect(() => {
fetchInventory(); fetchInventory();
}, [fetchInventory]); }, [fetchInventory, location.pathname]);
useEffect(() => { useEffect(() => {
if (inventory) { if (inventory) {