Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

Changes to selectedValues not reflected in display #112

Closed
andrewmwhite opened this issue Mar 6, 2016 · 7 comments
Closed

Changes to selectedValues not reflected in display #112

andrewmwhite opened this issue Mar 6, 2016 · 7 comments

Comments

@andrewmwhite
Copy link
Contributor

For instance, removing an element from selectedValues does not result in it's "selected" appearance changing to deselected. See JS Bin here.

The tests appear to cover cases where the selectedValues array is overwritten, not modified (pushed, shifted, spliced, etc., by the Polymer array mutation methods).

@bicknellr
Copy link
Contributor

Thanks for the repro; my first thought / hope is that this might be as simple as changing this observer to '_updateSelected(selectedValues.*)'.

@andrewmwhite
Copy link
Contributor Author

Neither using 'selectedValues.*' nor 'selectedValues.splices' works, at least according to this test case:
andrewmwhite@64f80e8

@bicknellr
Copy link
Contributor

@andrewmwhite, I talked with @cdata yesterday about this and he mentioned that selectedValues.* provides both the full array and the splices object at different times. Also, it doesn't seem like your branch actually changes the observer - am I missing something?

@andrewmwhite
Copy link
Contributor Author

My branch doesn't -- it just provides the test case. I tried both 'selectedValues.*' and 'selectedValues.splices' offline and neither worked.

@bicknellr
Copy link
Contributor

Oh, I just noticed that your tests use the native array methods; unfortunately, these won't trigger updates to bindings / observers / computed properties. Switching s.selectedValues.arrayFn(...args) to s.arrayFn('selectedValues', ...args) for these functions should help.

andrewmwhite added a commit to andrewmwhite/iron-selector that referenced this issue Mar 10, 2016
andrewmwhite added a commit to andrewmwhite/iron-selector that referenced this issue Mar 10, 2016
@andrewmwhite
Copy link
Contributor Author

Apparently my brain was checked out yesterday -- thanks for pointing that out. I've fixed the test case and implemented your suggested change, which passes the (fixed) tests. I'll submit a PR once I verify this fixes the downstream problem I was encountering.

@bicknellr
Copy link
Contributor

Awesome!

andrewmwhite added a commit to andrewmwhite/iron-selector that referenced this issue Mar 10, 2016
andrewmwhite added a commit to andrewmwhite/iron-selector that referenced this issue Mar 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants
@bicknellr @andrewmwhite and others