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

multi and fallback-selection cause the initial property flush to throw when set as attributes in HTML. #176

Open
4 tasks done
bicknellr opened this issue Jul 25, 2018 · 0 comments

Comments

@bicknellr
Copy link
Contributor

Description

When both the multi and fallback-selection attributes are set on an <iron-selector> in HTML, the first property flush throws in IronMultiSelectableBehavior.

When these two attributes are used together, the _checkFallback(fallbackSelection) observer in IronSelectableBehavior runs before the multiChanged observer in IronMultiSelectableBehavior. multiChanged would normally update this._selection.multi, which IronSelection uses to determine whether or not to return the full array of selected items or just the first item. However, _checkFallback is called first, which eventually calls down into _updateSelected, which reads this.multi and calls _selectMulti. _selectMulti assumes it's safe to consider the result of this._selection.get() to be an array, but this._selection.multi has not been updated yet and this._selection.get() returns undefined rather than an empty array, causing an error to be thrown on getting length.

Expected outcome

The initial property flush succeeds without throwing.

Actual outcome

The initial property flush throws an error on the first connectedCallback.

Live Demo

https://js-kt759o.stackblitz.io/ (https://stackblitz.com/edit/js-kt759o)

Steps to reproduce

In HTML <iron-selector> with the multi and fallback-selection attributes set.

Browsers Affected

  • Chrome
  • Firefox
  • Safari 11
  • Edge
bicknellr added a commit that referenced this issue Jul 25, 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

1 participant