Skip to content

Commit

Permalink
enhance JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed Apr 19, 2024
1 parent 6b72ee2 commit bd70e58
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions packages/combo-box/src/vaadin-combo-box-data-provider-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ export const ComboBoxDataProviderMixin = (superClass) =>

/** @private */
_sizeChanged(size) {
// When the size update originates externally, sync the new size with the controller
// and request a content update to re-render the scroller.
const { rootCache } = this._dataProviderController;

// When the size update originates externally, sync the new size
// with the controller and request a content update to re-render the scroller.
if (rootCache.size !== size) {
rootCache.size = size;
this.requestContentUpdate();
Expand All @@ -199,9 +200,9 @@ export const ComboBoxDataProviderMixin = (superClass) =>
return super._filteredItemsChanged(items);
}

// When the items update originates externally, sync the new items with the controller
// and request a content update to re-render the scroller.
const { rootCache } = this._dataProviderController;
// When the items update originates externally, sync the new items
// with the controller and request a content update to re-render the scroller.
if (rootCache.items !== items) {
rootCache.items = items;
this.requestContentUpdate();
Expand All @@ -213,19 +214,16 @@ export const ComboBoxDataProviderMixin = (superClass) =>
if (this.dataProvider) {
const { rootCache } = this._dataProviderController;

// Sync the controller's size with the component, which
// can be out of sync after e.g. the controller received new data.
// Sync the controller's state with the component. It can fall out of sync
// after the controller receives new data from the data provider or
// if the state in the controller is directly manipulated.
this.size = rootCache.size;

// Sync the controller's items with the component, which
// can be out of sync after e.g. the controller received new data.
this.filteredItems = rootCache.items;

// Sync the controller's loading state with the component.
this.loading = this._dataProviderController.isLoading();

// Set a copy of the controller's items as the dropdown items
// to trigger an update of the focused index in _setDropdownItems.
// Set a copy of the items as the dropdown items to ensure
// the virtualizer updates its size and the focused index
// points to the correct item.
this._setDropdownItems([...this.filteredItems]);
}

Expand Down

0 comments on commit bd70e58

Please sign in to comment.