Install using bunx shadcn@latest add @remix-utils/promise.
The promiseHash function is not directly related to Remix but it's a useful function when working with loaders and actions.
This function is an object version of Promise.all which lets you pass an object with promises and get an object with the same keys with the resolved values.
Install using bunx shadcn@latest add @remix-utils/promise.
The timeout function lets you attach a timeout to any promise, if the promise doesn't resolve or reject before the timeout, it will reject with a TimeoutError.
Install using
bunx shadcn@latest add @remix-utils/promise.The
promiseHashfunction is not directly related to Remix but it's a useful function when working with loaders and actions.This function is an object version of
Promise.allwhich lets you pass an object with promises and get an object with the same keys with the resolved values.You can use nested
promiseHashto get a nested object with resolved values.Install using
bunx shadcn@latest add @remix-utils/promise.The
timeoutfunction lets you attach a timeout to any promise, if the promise doesn't resolve or reject before the timeout, it will reject with aTimeoutError.Here the fetch needs to happen in less than 100ms, otherwise it will throw a
TimeoutError.If the promise is cancellable with an AbortSignal you can pass the AbortController to the
timeoutfunction.Here after 100ms,
timeoutwill callcontroller.abort()which will mark thecontroller.signalas aborted.Author
Sergio XalambrÃ