Fix edge cases
This release fixes two timing bugs and raises unit and mutation test coverage for useTimer, useThrottleCallback and useThrottleEffect.
Fixes
useTimer— the timer no longer goes negative when crossing zero. The stop condition was a strictupdatedSeconds === 0, so a fractional seconds count (e.g.useTimer(2.5)orrestart(0.4)) never landed exactly on0:activestayedtrueandcountran negative indefinitely. It now stops onupdatedSeconds <= 0with a clamp to0, matching the existing pattern indecrease().useThrottleCallback— a call arriving right after a trailing invocation no longer bypasses the throttle window.isCalledRefwas reset unconditionally on every timer tick, so the next call sawisCalledRef === falseand fired immediately instead of queuing, breaking the once-per-delay guarantee. The reset now happens only when there are no pending trailing calls, matchingutils/helpers/throttle.ts.useThrottleStateanduseThrottleValueinherit the fix since both wrapuseThrottleCallback.
Changes
- Raised unit and mutation test coverage for
useTimer,useThrottleCallbackanduseThrottleEffect. - Added new reactuse agent skills for React hooks best practices.