-
Notifications
You must be signed in to change notification settings - Fork 60
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
Fixes log duplication issue #722
Conversation
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.
Thank you!
if (canceled !== true) { | ||
// The server shouldn't return NaN, but just in case and be defensive, | ||
// we don't want to add NaN to the accumulatedLines. | ||
if (!isNaN(pulledLines!)) { |
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.
Also log if this happens?
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.
I interpret that we want to log the isNaN
case instead of !isNan
. If so, a change is made as change.
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.
Approving because I tested and it appears to have resolved one case of duplicated logging that used to be fairly easy to reproduce.
708a2e3
to
bdebd6e
Compare
A bug occurs when logs are already loading, and an accidental simultaneous scroll event triggers another log pull. The second pull will append the same logs twice. According to the previous work, we can already sequentialize the pulls using a queue. So the fix is to avoid the second pull being issued if we discovered from the first pull that there would be no more logs. This PR does such, and some extras: 1. Add more loggings to understand the async queuing and execution details 2. A helper function `useRefFn` to avoid the initial value of `useRef` being re-created multiple times across rendering. (see also [here](facebook/react#14490)) 3. Convert `AsyncInvocationQueue` from a function to a class to carry more responsibilities 4. Updated unit test accordingly. --------- Co-authored-by: tscurtu <[email protected]>
A bug occurs when logs are already loading, and an accidental simultaneous scroll event triggers another log pull. The second pull will append the same logs twice.
According to the previous work, we can already sequentialize the pulls using a queue. So the fix is to avoid the second pull being issued if we discovered from the first pull that there would be no more logs.
This PR does such, and some extras:
useRefFn
to avoid the initial value ofuseRef
being re-created multiple times across rendering. (see also here)AsyncInvocationQueue
from a function to a class to carry more responsibilities