useDebouncedAsyncValue Function

Custom hook for working with promise values. Promises are debounced using trailing and leading edge. The first promise will always be executed. Any promises following the first while it is executing will be scheduled (and unscheduled), leaving only the last promise to be resolved. Once the first promise finishes resolving, the last passed promise starts resolving.

useDebouncedAsyncValue<TReturn>(valueToBeResolved: () => Promise<TReturn>): { inProgress: boolean, value: undefined | TReturn }

@throws if/when valueToBeResolved promise is rejected. The error is thrown in the React's render loop, so it can be caught using an error boundary.

Parameter Type Description
valueToBeResolved () => Promise<TReturn>  

Returns - { inProgress: boolean, value: undefined | TReturn }

Defined in

Last Updated: 17 December, 2024