File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 190
190
estimatedMissingRowCount = Math . max ( 0 , this . _effectiveSize - this . _physicalCount ) ;
191
191
}
192
192
193
- if ( this . _physicalSize && estimatedMissingRowCount > 0 ) {
193
+ if ( this . _physicalSize && estimatedMissingRowCount > 0 && this . _optPhysicalSize !== Infinity ) {
194
194
super . _increasePoolIfNeeded ( estimatedMissingRowCount ) ;
195
195
// Ensure the rows are in order after increasing pool
196
196
this . __reorderChildNodes ( ) ;
Original file line number Diff line number Diff line change 140
140
expect ( spy ) . not . to . be . called ;
141
141
} ) ;
142
142
143
+ it ( 'should not add unlimited amount of physical rows' , ( ) => {
144
+ const itemCount = 50 ;
145
+ grid . items = buildDataSet ( itemCount ) ;
146
+ flushGrid ( grid ) ;
147
+
148
+ // Repro for a really special bug:
149
+
150
+ // 1: notifyResize will trigger _increasePoolIfNeeded
151
+ grid . notifyResize ( ) ;
152
+ // 2: Hide grid
153
+ grid . hidden = true ;
154
+ // 3: notifyResize will trigger updateViewportBoundaries which sets _viewPortHeight to 0 because grid is not rendered
155
+ grid . notifyResize ( ) ;
156
+ // 4: Restore grid to render tree
157
+ grid . hidden = false ;
158
+ // 5: Finally flush the grid, and finish the async callback started at phase 1.
159
+ // _optPhysicalSize will be Infinity at this point so unlimited amount of rows would get added!
160
+ // Only thing that limits it is the grid.items count.
161
+ flushGrid ( grid ) ;
143
162
163
+ expect ( grid . $ . items . childElementCount ) . to . be . below ( itemCount ) ;
164
+ } ) ;
144
165
} ) ;
145
166
</ script >
146
167
You can’t perform that action at this time.
0 commit comments