I'm not sure if this is a bug, but it surely took us some time to figure out.
Since Reusability is implemented for functional components by using a counter in a useState, having a Reusability.never will cause infinite re-renders if renderWithReuse or withReuse are used to render. I suspect this will also be the case in use*WithDeps hooks.
This is somewhat different behavior than when using Reusability.never on a class component, where if all dependencies have Reusability.never then the component will behave the same way as if reusability was not set.
I'm not sure if this is a bug, but it surely took us some time to figure out.
Since
Reusability
is implemented for functional components by using a counter in auseState
, having aReusability.never
will cause infinite re-renders ifrenderWithReuse
orwithReuse
are used to render. I suspect this will also be the case inuse*WithDeps
hooks.Basically, this line will be invoked in every render: https://github.com/japgolly/scalajs-react/blob/master/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala#L187.
This is somewhat different behavior than when using
Reusability.never
on a class component, where if all dependencies haveReusability.never
then the component will behave the same way as if reusability was not set.