Skip to content

Commit ccc2e03

Browse files
committed
Force render next zone then overs is going to reach last item. #91
1 parent 886b937 commit ccc2e03

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,18 @@
142142
var bench = this.bench || this.remain
143143

144144
// for better performance, if scroll pass items within now bench, do not update.
145-
if (!zone.isLast && (overs > delta.start) && (overs - delta.start <= bench)) {
145+
// and if overs is going to reach last item, we should render next zone immediately.
146+
var shouldRenderNextZone = Math.abs(overs - delta.start - bench) === 1
147+
if (
148+
!shouldRenderNextZone &&
149+
(overs - delta.start <= bench) &&
150+
!zone.isLast && (overs > delta.start)
151+
) {
146152
return
147153
}
148154

149-
// we'd better make sure calls as less as possible.
150-
if (zone.start !== delta.start || zone.end !== delta.end) {
155+
// we'd better make sure forceRender calls as less as possible.
156+
if (shouldRenderNextZone || zone.start !== delta.start || zone.end !== delta.end) {
151157
delta.end = zone.end
152158
delta.start = zone.start
153159
this.forceRender()

0 commit comments

Comments
 (0)