@vaadin/component-base 25.0.4 → 25.0.6

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": "25.0.4",
3
+ "version": "25.0.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,10 +37,10 @@
37
37
  "lit": "^3.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@vaadin/chai-plugins": "~25.0.4",
41
- "@vaadin/test-runner-commands": "~25.0.4",
40
+ "@vaadin/chai-plugins": "~25.0.6",
41
+ "@vaadin/test-runner-commands": "~25.0.6",
42
42
  "@vaadin/testing-helpers": "^2.0.0",
43
43
  "sinon": "^21.0.0"
44
44
  },
45
- "gitHead": "17170982c3efa1d426af4fabb70ea36b70151347"
45
+ "gitHead": "bcf72177eb200c88e07e6458e1de37e32ce18f88"
46
46
  }
package/src/define.js CHANGED
@@ -13,7 +13,7 @@ function dashToCamelCase(dash) {
13
13
 
14
14
  const experimentalMap = {};
15
15
 
16
- export function defineCustomElement(CustomElement, version = '25.0.4') {
16
+ export function defineCustomElement(CustomElement, version = '25.0.6') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2026 - 2026 Vaadin Ltd.
3
+ * Copyright (c) 2025 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
package/src/i18n-mixin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2026 - 2026 Vaadin Ltd.
3
+ * Copyright (c) 2025 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2026 - 2026 Vaadin Ltd.
3
+ * Copyright (c) 2025 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2026 - 2026 Vaadin Ltd.
3
+ * Copyright (c) 2025 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './style-props.js';
@@ -350,13 +350,12 @@ export class IronListAdapter {
350
350
  this._debouncers._increasePoolIfNeeded.cancel();
351
351
  }
352
352
 
353
- // Prevent element update while the scroll position is being restored
354
- this.__preventElementUpdates = true;
353
+ const shouldRestoreScrollPosition = size > 0 && this._scrollTop > 0;
355
354
 
356
355
  // Record the scroll position before changing the size
357
356
  let fvi; // First visible index
358
357
  let fviOffsetBefore; // Scroll offset of the first visible index
359
- if (size > 0) {
358
+ if (shouldRestoreScrollPosition) {
360
359
  fvi = this.adjustedFirstVisibleIndex;
361
360
  fviOffsetBefore = this.__getIndexScrollOffset(fvi);
362
361
  }
@@ -364,13 +363,19 @@ export class IronListAdapter {
364
363
  // Change the size
365
364
  this.__size = size;
366
365
 
366
+ // Attempts to update elements during _itemsChanged and the subsequent
367
+ // scrollToIndex should be skipped when the scroll position needs to be
368
+ // restored (scroll position > 0 before size change). Otherwise, these
369
+ // element updates can cause the component to make incorrect server
370
+ // requests in its updateElement callback.
371
+ this.__preventElementUpdates = shouldRestoreScrollPosition;
372
+
367
373
  this._itemsChanged({
368
374
  path: 'items',
369
375
  });
370
376
  flush();
371
377
 
372
- // Try to restore the scroll position if the new size is larger than 0
373
- if (size > 0) {
378
+ if (shouldRestoreScrollPosition) {
374
379
  fvi = Math.min(fvi, size - 1);
375
380
  // Note, calling scrollToIndex also updates the virtual index offset,
376
381
  // causing the virtualizer to add more items when size is increased,
@@ -396,9 +401,16 @@ export class IronListAdapter {
396
401
  requestAnimationFrame(() => this._resizeHandler());
397
402
  }
398
403
 
399
- // Schedule and flush a resize handler
404
+ // Re-render items once the scroll position has been restored.
405
+ // This call also updates the cached scrollTarget height and
406
+ // rechecks whether more virtual elements are needed, since the
407
+ // scrollTarget's height may change after the scrollContainer's
408
+ // height is determined and set, requiring more elements to fill
409
+ // the viewport (e.g., in combo-box, where the scroller height
410
+ // depends on the height of #selector element in the shadow DOM).
400
411
  this._resizeHandler();
401
412
  flush();
413
+
402
414
  // Schedule an update to ensure item positions are correct after subsequent size changes
403
415
  // Fix for https://github.com/vaadin/flow-components/issues/6269
404
416
  this._debounce('_update', this._update, microTask);