@vaadin/component-base 24.1.0-alpha1 → 24.1.0-alpha3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "24.1.0-alpha1",
3
+ "version": "24.1.0-alpha3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,5 +42,5 @@
42
42
  "@vaadin/testing-helpers": "^0.4.0",
43
43
  "sinon": "^13.0.2"
44
44
  },
45
- "gitHead": "599a339181595923b9ad6373d6888d8a79540141"
45
+ "gitHead": "077b4a8e8fff063b9eba4581af81f9e152cb852d"
46
46
  }
@@ -45,7 +45,7 @@ const registered = new Set();
45
45
  export const ElementMixin = (superClass) =>
46
46
  class VaadinElementMixin extends DirMixin(superClass) {
47
47
  static get version() {
48
- return '24.1.0-alpha1';
48
+ return '24.1.0-alpha3';
49
49
  }
50
50
 
51
51
  /** @protected */
@@ -249,42 +249,28 @@ export class IronListAdapter {
249
249
  this._debouncers._increasePoolIfNeeded.cancel();
250
250
  }
251
251
 
252
- // Prevent element update while the scroll position is being restored
253
- this.__preventElementUpdates = true;
254
-
255
- // Record the scroll position before changing the size
256
- let fvi; // First visible index
257
- let fviOffsetBefore; // Scroll offset of the first visible index
258
- if (size > 0) {
259
- fvi = this.adjustedFirstVisibleIndex;
260
- fviOffsetBefore = this.__getIndexScrollOffset(fvi);
261
- }
262
-
263
252
  // Change the size
264
253
  this.__size = size;
265
254
 
266
- this._itemsChanged({
267
- path: 'items',
268
- });
269
- flush();
270
-
271
- // Try to restore the scroll position if the new size is larger than 0
272
- if (size > 0) {
273
- fvi = Math.min(fvi, size - 1);
274
- this.scrollToIndex(fvi);
275
-
276
- const fviOffsetAfter = this.__getIndexScrollOffset(fvi);
277
- if (fviOffsetBefore !== undefined && fviOffsetAfter !== undefined) {
278
- this._scrollTop += fviOffsetBefore - fviOffsetAfter;
279
- }
255
+ if (!this._physicalItems) {
256
+ // Not initialized yet
257
+ this._itemsChanged({
258
+ path: 'items',
259
+ });
260
+ this.__preventElementUpdates = true;
261
+ flush();
262
+ this.__preventElementUpdates = false;
263
+ } else {
264
+ // Already initialized, just update _virtualCount
265
+ this._virtualCount = this.items.length;
280
266
  }
281
267
 
282
268
  if (!this.elementsContainer.children.length) {
283
269
  requestAnimationFrame(() => this._resizeHandler());
284
270
  }
285
271
 
286
- this.__preventElementUpdates = false;
287
- // Schedule and flush a resize handler
272
+ // Schedule and flush a resize handler. This will cause a
273
+ // re-render for the elements.
288
274
  this._resizeHandler();
289
275
  flush();
290
276
  }