A function that returns the promise to await, or undefined for
nothing to run.
WARNING: MUST BE STABLE - const or wrapped in useCallback. A reference that is updated every
render re-runs the fetch every render, exactly as it does with usePromise.
Awaits a promise like
usePromise, and additionally reports whether it rejected and offers a way to run it again.usePromisealone leaves a rejection indistinguishable from a value that has not arrived, so a UI driven by it can only say "nothing here" for a failure — with no way for the user to try again. This hook adds the two things such a UI needs: a failure flag and a working retry.Deliberately takes the fetch as a callback rather than performing one itself, so this library stays free of any PAPI dependency and both the renderer and extension web views can use it with their own command-sending mechanism.