fix: Prevent initial unnecessary IntersectionObserver callback execution by sy-records · Pull Request #2523 · docsifyjs/docsify
Summary
- Added a flag (
isInitialLoad) to skip the first callback execution of the IntersectionObserver on page load.
Related issue, if any:
What kind of change does this PR introduce?
Bugfix
For any code change,
- Related documentation has been updated, if needed
- Related tests have been added or updated, if needed
Does this PR introduce a breaking change?
No
Yes
No
Tested in the following browsers:
- Chrome
- Firefox
- Safari
- Edge
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!
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters