UNPKG

@gravity-ui/data-source

Version:
18 lines 649 B
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; import { useCallback } from 'react'; export var useRefetchErrored = function useRefetchErrored(states) { return useCallback(function () { return states.forEach(function (_ref) { var error = _ref.error, refetch = _ref.refetch; return error && refetch(); }); }, // eslint-disable-next-line react-hooks/exhaustive-deps states.reduce(function (acc, _ref2) { var error = _ref2.error, refetch = _ref2.refetch; return [].concat(_toConsumableArray(acc), [error, refetch]); }, [])); }; // #sourceMappingURL=useRefetchErrored.js.map