Problem
useCallableFunctionResponse constructs its observable source eagerly via rxfire's httpsCallable, which invokes the cloud function at hook-render time. Every re-render that doesn't hit the observable cache fires a real cloud function call that is then discarded.
Unlike useIdTokenResult (which wastes a network read), this has a write-side effect: the function executes and bills against quota on every render cycle.
Fix
Wrap in defer() so the function is invoked at subscription time, not render time:
const observable$ = defer(() => httpsCallable(functionRef, data, options));
Related
Problem
useCallableFunctionResponseconstructs its observable source eagerly via rxfire'shttpsCallable, which invokes the cloud function at hook-render time. Every re-render that doesn't hit the observable cache fires a real cloud function call that is then discarded.Unlike
useIdTokenResult(which wastes a network read), this has a write-side effect: the function executes and bills against quota on every render cycle.Fix
Wrap in
defer()so the function is invoked at subscription time, not render time:Related
useStorageDownloadURLuseIdTokenResult