UNPKG

react-async-states

Version:

A low-level multi paradigm state management library

28 lines (25 loc) 986 B
import { useAsync_internal } from './useAsync_internal.js'; import { setCurrentHookOverrides } from './modules/HookResolveConfig.js'; // missing point: // initial return may have data as null (in a typing point of view) // this point will be challenging to be addressed, it should be typed deep down // to the Source itself and the StateInterface. which may be impossible // think about that later. a data: null may be okay for now. let concurrentOverrides = { concurrent: true, throwError: true, }; function useData_internal(options, deps, overrides) { try { setCurrentHookOverrides(concurrentOverrides); // this will mimic useAsync and get its result let result = useAsync_internal(options, deps, overrides); // the result here is guaranteed to be either initial or success return result; } finally { setCurrentHookOverrides(null); } } export { useData_internal }; //# sourceMappingURL=useData_internal.js.map