New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(replay): Fix debounce when maxWait
== wait
#7208
Conversation
size-limit report 📦
|
Replay SDK metrics 🚀
develop |
Revision | LCP | CLS | CPU | JS heap avg | JS heap max | netTx | netRx | netCount | netTime |
---|---|---|---|---|---|---|---|---|---|
1cf8988 | +53.81 ms | -0.00 ms | +4.80 pp | +929.88 kB | +1.05 MB | +2.22 kB | +41 B | +1 | +91.07 ms |
68655e3 | +72.60 ms | +0.00 ms | +7.90 pp | +922.72 kB | +1.04 MB | +2.22 kB | +41 B | +1 | +109.40 ms |
a8449de | +58.27 ms | -0.00 ms | +7.12 pp | +927.42 kB | +1.05 MB | +2.2 kB | +41 B | +1 | +98.31 ms |
79babe9 | +58.69 ms | -0.00 ms | +4.40 pp | +927.46 kB | +1.06 MB | +2.23 kB | +41 B | +1 | +103.20 ms |
5359ba9 | +55.62 ms | -0.00 ms | +4.29 pp | +935.26 kB | +1.05 MB | +2.2 kB | +41 B | +1 | +79.05 ms |
Last updated: Thu, 16 Feb 2023 20:44:16 GMT
@@ -57,8 +57,13 @@ export function debounce(func: CallbackFunction, wait: number, options?: Debounc | |||
} | |||
timerId = setTimeout(invokeFunc, wait); | |||
|
|||
if (maxWait && maxTimerId === undefined && maxWait !== wait) { | |||
maxTimerId = setTimeout(invokeFunc, maxWait); | |||
if (maxWait && maxTimerId === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, invokeFunc
already calls clearTimeout
, so we can streamlime this slightly - IMHO we only need to remove the maxWait !== wait
part, which was an incorrect "streamlining" that we added.
I'll adjust this and merge this and will actually release this fix today as well!
Update and fix tests for debounce when `maxWait` == `wait`.
48483f6
to
cb71021
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good! I'll leave the default max wait time at 5500 for now, we can then later think about reverting this back to 5000 - IMHO it's also OK to leave it at 5500, I guess.
Update and fix tests for debounce when
maxWait
==wait
.