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

selectedItem momentarily becomes undefined when selection changes. #118

Open
tommycli opened this issue Apr 11, 2016 · 2 comments
Open

selectedItem momentarily becomes undefined when selection changes. #118

tommycli opened this issue Apr 11, 2016 · 2 comments
Assignees

Comments

@tommycli
Copy link

Description

selectedItem property momentarily becomes undefined when the selection changes. This fires computed bindings.

Expected outcome

selectedItem directly changes from 'before' to 'after', or doesn't fire computed bindings in between.

Actual outcome

The computed binding is fired with selectedItem === undefined.

Live Demo

http://jsbin.com/zidelanake/1/edit?html,js,console,output

Steps to reproduce

  1. Load the live demo
  2. Click the "Next" button in the Output pane
  3. Observe the Console.

Actual:
"getSelectedItemId result: one"
"getSelectedItemId result: undefined"
"getSelectedItemId result: two"

Expected:
"getSelectedItemId result: one"
"getSelectedItemId result: two"

Browsers Affected

Chrome, though I imagine it affects others also.

@bicknellr bicknellr self-assigned this Apr 18, 2016
bicknellr added a commit that referenced this issue Apr 19, 2016
… when changing selection if multi === false.
bicknellr added a commit that referenced this issue Apr 27, 2016
… when changing selection if multi === false.
@bicknellr
Copy link
Contributor

#120 is a potential fix for this; it still needs some clean up though.

@chiefcll
Copy link

Any progress on getting this fixed? When a selectedItem changes not getting the previousValue on the change handler is very frustrating.

I've traced the issue to
https://github.com/PolymerElements/iron-selector/blob/master/iron-selection.html#L75-L84 - selectedItem is removed from the selection array and then
this gets called https://github.com/PolymerElements/iron-selector/blob/master/iron-selectable.html#L365-L367 - which is then empty cause the selectedItem was removed in the previous function.

bicknellr added a commit that referenced this issue Jul 7, 2017
… when changing selection if multi === false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants