[组件-极简首页] fix: 修复 ScrollTrigger
在特定情况下无法触发加载的问题
#4430
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix #4302
如题,当
ScrollTrigger
初次触发加载且父级组件完成加载后,如果因为高分屏、低缩放比例等原因,使ScrollTrigger
仍在视口内部的话,将会导致IntersectionObserver
无法继续触发,接着导致组件无法自动触发加载,最后导致受影响用户遇到父级组件不会自动继续加载的问题。无法继续触发
IntersectionObserver
的原因是,此时页面滚动不了,ScrollTrigger
无法离开和进入视口。这个 PR 通过为
ScrollTrigger
增加可视判断逻辑来修复上述问题,同时可以解决 #4302 报告的情况。由于问题描述有点区别,可能没有解决这条回复和 #4428 遇到的问题,需要后续反馈才能确认具体情况。
另外,为了避免可视判断逻辑造成的重复加载情况,这个修复方法还需要修改用到
ScrollTrigger
并且需要它的可视判断逻辑的组件代码,使其能够向ScrollTrigger
传递加载状态。考虑到一次性全改了可能会出现奇奇怪怪的问题,所以这个 PR 只调整了有问题报告的极简首页组件,可以先看看效果。