You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.
With usePresence, I was trying to call updateStatus when user information changes, but dropping it in a useEffect hook was triggering it in a loop since the updateStatus function changes every render.
Can that function be wrapped in useCallback() or something to prevent it from triggering updates?
The "solution" right now is to just leave updateStatus off the dependency array, but that's not ideal since linters and React complain about "exhaustive dependencies".
useEffect(()=>{
if ( userData ) updateStatus(userData);
},[userData]); // No infinite loop
The text was updated successfully, but these errors were encountered:
Hey @shshaw, we have update the library so that updateStatus is now wrapped in a useCallback, please try out the new version (2.1.1) and let us know if you have any further issues 🙂
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
With
usePresence
, I was trying to callupdateStatus
when user information changes, but dropping it in auseEffect
hook was triggering it in a loop since theupdateStatus
function changes every render.Can that function be wrapped in
useCallback()
or something to prevent it from triggering updates?Example of the problem:
The "solution" right now is to just leave
updateStatus
off the dependency array, but that's not ideal since linters and React complain about "exhaustive dependencies".The text was updated successfully, but these errors were encountered: