CSFrequency / react-firebase-hooks

React Hooks for Firebase.
Apache License 2.0
3.55k stars 304 forks source link

fix useHttpsCallable causing infinite re-rendering #268

Closed pzmudzinski closed 1 year ago

pzmudzinski commented 1 year ago

Since current implementation does not wrap callCallable in useCallback it creates new instance of it on every render. If you use it in useEffect and add it as dependency it will keep running infinitely. In addition for some reason hook is wrapped in useMemo which does absolutely nothing. This PR fixes those two issues and simplifies code little bit.

chrisbianca commented 1 year ago

@pzmudzinski thank you for the submission and apologies it's taken a while to get this merged. I'll do some testing and get this included in an upcoming release.