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 }}
Repository navigation
Discrepancy between lodash and compat throttle with both trailing and leading disabled #1494
While I was sanity-checking the reproduction on this issue, I've found that there's a discrepancy between lodash and compat throttle:
importlodashThrottlefrom'lodash-es/throttle';importcompatThrottlefrom'es-toolkit/compat/throttle';constWAIT=100;constOPTIONS={leading: false,trailing: false};constlodashThrottled=lodashThrottle(()=>console.log('lodashThrottled'),WAIT,OPTIONS);constcompatThrottled=compatThrottle(()=>console.log('compatThrottled'),WAIT,OPTIONS);// These seem to be mostly consistent on my machinesetInterval(lodashThrottled,1);setInterval(compatThrottled,1);// Things start to get inconsistentsetInterval(lodashThrottled,100);setInterval(compatThrottled,100);// Lodash now executes far more rarely, while compat seems to execute according to delay// The lodash timing appears to grow exponentially compared to compatsetInterval(lodashThrottled,115);setInterval(compatThrottled,115);// Note: system/browser workload seems to increase the timing inconsistencies as well
This is a bit extreme edge case considering this seems to happen only with both trailing and leading edges disabled, but configuration like this is still implicitly allowed (even though the effects of doing so are not generally established), so I thought it deserved mention.
Activity
constantly-dev commentedon Dec 18, 2025
I'd like to work on this. Could you assign it to me?
raon0211 commentedon Jan 23, 2026
This actually seems to be a bug
constantly-dev commentedon Jan 23, 2026
@raon0211 Thank you!
I've left a comment on PR #1560 regarding the potential fix for the root cause. Could you please take a look?