[X] I have confirmed that this bug has not been reported yet
Description
When using jest.useFakeTimers() in tests, RNRH logs a whole lot of warnings, even when only rendering the component once.
I've also found the root cause. When using the fake timers, Jest patches performance.now() (among others). Crucially, it sets the return value to 0 by default (you can advance this value using jest.advanceTimersByTime() and related utilities, but the default is 0)
Unfortunately, RNRH also uses 0 as the default of the lastUpdate ref (source). Therefore, on the very first render, RNRH thinks the previous render happened exactly 0ms ago, and prints a bunch of warnings!
I realize this is not really a "bug" per se, and definitely won't affect any end users. However, it might confuse other devs like it confused me, and the fix is probably quite simple.
Decision Table
<yyy>
is not rendered”Good Faith Declaration
Description
When using
jest.useFakeTimers()
in tests, RNRH logs a whole lot of warnings, even when only rendering the component once.I've also found the root cause. When using the fake timers, Jest patches
performance.now()
(among others). Crucially, it sets the return value to0
by default (you can advance this value usingjest.advanceTimersByTime()
and related utilities, but the default is0
) Unfortunately, RNRH also uses0
as the default of thelastUpdate
ref (source). Therefore, on the very first render, RNRH thinks the previous render happened exactly 0ms ago, and prints a bunch of warnings!I realize this is not really a "bug" per se, and definitely won't affect any end users. However, it might confuse other devs like it confused me, and the fix is probably quite simple.
React Native Information
RNRH Version
6.3.4
Tested Platforms
Reproduction Platforms
Minimal, Reproducible Example
https://github.com/meliorence/react-native-render-html/pull/664
Additional Notes
No response