Skip to content

Commit 38c78d1

Browse files
authored
Fix null data on Firebase Functions backend (#99)
* move callable initialization outside callback * remove `call` and simply invoke
1 parent 146e708 commit 38c78d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/functions/useCallFunction.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ export const useCallFunction = (
3030
{ name, httpsCallableOptions }: UseCallFunctionOptions,
3131
): UseCallFunction => {
3232
const [state, setState] = useState<UseCallFunctionState>("ready");
33+
const callable = httpsCallable(functions, name, httpsCallableOptions);
3334

3435
const invoke: UseCallFunctionInvoker = async (data: unknown = {}) => {
3536
setState("loading");
36-
const r = httpsCallable(functions, name, httpsCallableOptions).call(data);
37+
const r = callable(data);
3738
setState("done");
3839
return r;
3940
};

0 commit comments

Comments
 (0)