fix(Sticky): initial sticky position #12601
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 issue: #12593
relate history issue: #12535
relate PR: #12547
@chenjiahan
我回退掉了 #12547 的改动,当时没考虑到异步组件的场景
issue: #12593 看起来比 issue: #12535 更严重,妥妥的反向修复🤡
这样的话top = 0在这种场景下是有意义的,而且没有很好的简单方式去处理,如果强行修复的话反而把代码搞复杂了。
原先的issue我想了下,理论上不应该出现两个重叠吸顶的情况,还是应该用issue上其他的评论方式去解决,比如设置一个
sticky-top
。本来想加个单测去覆盖这种顶部有异步组件的场景,但是发现
<Sticky />
组件用到的useVisibilityChange
必须在浏览器场景下才可以,所以单测也不好加。