-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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: Prevent initial unnecessary IntersectionObserver callback execution #2523
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Thanks @sy-records , created Sandbox and tested (see issue comments) - all looks good to me!
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.
Looks good, @sy-records. A few minor nitpicks.
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.
Shall we promote the isInitialLoad
to the Object level as a field?
Then, we could reuse and keep consistence when any logic relies on the same isInitialLoad
lifecycle flag in future.
8dd1a0e
to
d0d4383
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.
Thanks @sy-records and @jhildenbiddle , I've retested in the sandbox (with new Preview build) and things look good to me!
https://codesandbox.io/p/sandbox/docsify-v5-sidebar-fix-zwdm6p
Summary
isInitialLoad
) to skip the first callback execution of the IntersectionObserver on page load.Related issue, if any:
Fix #2504
Fix #2509
What kind of change does this PR introduce?
Bugfix
For any code change,
Does this PR introduce a breaking change?
No
Yes
No
Tested in the following browsers: