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
As @peterstuart ran into, currently if you pass either a dependencies array containing a path (eg ['user.isAuthorized']) or a callback-style dependency argument to useEffect() (and I think the same would be true for useLayoutEffect()) which returns a cleanup callback, the cleanup callback isn't called at the correct time because from React's view of the world it's re-running the effect on every render (not just when the dependencies have "changed")
It looked like it would be possible to modify the implementation to avoid this for path-style dependency arrays but the problem seems more fundamental for callback-style dependency arguments
The workaround is to "pre-compute" (eg via an addProps()) a top-level prop that can then be passed as a "simple" dependencies argument array to addEffect()
The text was updated successfully, but these errors were encountered:
As @peterstuart ran into, currently if you pass either a dependencies array containing a path (eg
['user.isAuthorized']
) or a callback-style dependency argument touseEffect()
(and I think the same would be true foruseLayoutEffect()
) which returns a cleanup callback, the cleanup callback isn't called at the correct time because from React's view of the world it's re-running the effect on every render (not just when the dependencies have "changed")It looked like it would be possible to modify the implementation to avoid this for path-style dependency arrays but the problem seems more fundamental for callback-style dependency arguments
The workaround is to "pre-compute" (eg via an
addProps()
) a top-level prop that can then be passed as a "simple" dependencies argument array toaddEffect()
The text was updated successfully, but these errors were encountered: