Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Filtered Items no longer works with dynamically created combobox. Filtering many items then selecting an item causes DOM to hang. #615

Closed
7 tasks done
flyweight opened this issue Feb 10, 2018 · 3 comments
Assignees
Milestone

Comments

@flyweight
Copy link

flyweight commented Feb 10, 2018

Description

  1. When adding vaadin combobox dynamically, only supplying filtered-items prevents the ability to provide a selected value.
  2. Using many items, filtering the dropdown, and then selecting one of the items hangs the DOM for seconds.

Expected outcome

  1. Only supplying filtered-items in a dynamically created vaadin combobox should not cause an exception.
  2. Upon filtering and selecting an item, it should not hang the DOM.

Actual outcome

  1. Supplying filtered-items throws the exception:
"TypeError: Cannot read property '5' of undefined
    at HTMLElement._getFocusedItem (https://polygit.org/vaadin-combo-box+vaadin+3.0.3/polymer+%5E2.0.0/components/vaadin-combo-box/vaadin-combo-box-dropdown-wrapper.html:210:29)
    at runMethodEffect (https://polygit.org/vaadin-combo-box+vaadin+3.0.3/polymer+%5E2.0.0/components/polymer/lib/mixins/property-effects.html:813:17)
    at Object.runComputedEffect [as fn] (https://polygit.org/vaadin-combo-box+vaadin+3.0.3/polymer+%5E2.0.0/components/polymer/lib/mixins/property-effects.html:432:18)
    at runEffectsForProperty (https://polygit.org/vaadin-combo-box+vaadin+3.0.3/polymer+%5E2.0.0/components/polymer/lib/mixins/property-effects.html:159:14)
    at runEffects (https://polygit.org/vaadin-combo-box+vaadin+3.0.3/polymer+%5E2.0.0/components/polymer/lib/mixins/property-effects.html:125:13)
    at runComputedEffects (https://polygit.org/vaadin-combo-box+vaadin+3.0.3/polymer+%5E2.0.0/components/polymer/lib/mixins/property-effects.html:409:14)
    at HTMLElement._propertiesChanged (https://polygit.org/vaadin-combo-box+vaadin+3.0.3/polymer+%5E2.0.0/components/polymer/lib/mixins/property-effects.html:1691:9)
    at HTMLElement._flushProperties (https://polygit.org/vaadin-combo-box+vaadin+3.0.3/polymer+%5E2.0.0/components/polymer/lib/mixins/properties-changed.html:338:18)
    at HTMLElement._flushProperties (https://polygit.org/vaadin-combo-box+vaadin+3.0.3/polymer+%5E2.0.0/components/polymer/lib/mixins/property-effects.html:1551:15)
    at HTMLElement.__enableOrFlushClients (https://polygit.org/vaadin-combo-box+vaadin+3.0.3/polymer+%5E2.0.0/components/polymer/lib/mixins/property-effects.html:1596:22)"
  1. DOM hangs for seconds when filtering then selecting an item.

Live Demo

jsbin

Steps to reproduce

In the video, I change filtered-items to items, which circumvents the exception but breaks my particular use case. It also causes the DOM to hang when filtering and selecting an item.

video

Browsers Affected

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE 11
  • iOS Safari
  • Android Chrome
@tomivirkki tomivirkki added the needs triage Has to be triaged by the team label Feb 12, 2018
@flyweight
Copy link
Author

flyweight commented Feb 16, 2018

The following changes seem to fix the first item in this issue. However, it causes another problem. Upon selecting an item, opening the dropdown, and selecting a different item, the selected value does not change anymore.

File : vaadin-combo-box/vaadin-combo-box-mixin.html

 590     _selectedItemChanged(selectedItem) {
...
 618       Polymer.RenderStatus.afterNextRender(this, () => {
 619         this.$.overlay._selectedItem = selectedItem;
 620         if (Array.isArray(this.filteredItems)) {
 621           this._focusedIndex = this.filteredItems.indexOf(selectedItem);
 622         }
 623       });
 624     }

For the second issue (slowness after selecting an item upon having filtered the list), here is a performance audit:

performance

@web-padawan
Copy link
Member

@flyweight the second point of your issue (DOM hangs for seconds) is now in progress, see #618

@flyweight
Copy link
Author

Thanks @web-padawan 👍

@yuriy-fix yuriy-fix added this to the v4.0.0-beta5 milestone Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants