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

ListPicker Selection change not working properly when we set the selectedList using setState #315

Closed
jyothsnag1987 opened this issue May 27, 2019 · 6 comments

Comments

@jyothsnag1987
Copy link

Category

[ ] Enhancement

[X] Bug

[ ] Question

Version

Please specify what version of the library you are using: [ 1.13.2 ]

Expected / Desired Behavior / Question

On selection change, selectedList should be highlighted and options should not be repeated

Observed Behavior

On ListPicker selection change, selectedList is getting highlighted but the options are binding again
Capture

Steps to Reproduce

After migrating my project from SPFx 1.6 to SPFx 1.8.2 I started seeing this issue.
If we don't set the selectionList from state then we wont have issue. But in my scenario I need to set the selectedList from state and it should be stored back to the state on selectionChanged event

@ghost
Copy link

ghost commented May 27, 2019

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label May 27, 2019
@justdevelopment
Copy link

After some research we think it's related to the control pushing all found lists to the _options, without checking if the item is already in this list. As this function is also called on any change done to the selected item it will duplicate all items again and again on change. It's unclear to us why this issue started after upgrading our project.

A proposed solution would be to check if the item is already in the list before pushing;

results.value.map(list => {
        if (!this.optionsContainsList(list)) {
          this._options.push({
            key: list.Id,
            text: list.Title
          });
        }
      });

@estruyf
Copy link
Member

estruyf commented Jul 9, 2019

This should have been fixed. You can test it out in the latest beta version and will be available in 1.14.0. More information on how you can test out a beta version can be found here: https://sharepoint.github.io/sp-dev-fx-controls-react/beta/

@estruyf estruyf added this to the 1.14.0 milestone Jul 9, 2019
@jyothsnag1987
Copy link
Author

Thank you for providing the fix, Its working fine with beta version. Could we know the planned target date for 1.14.0 release.

@estruyf
Copy link
Member

estruyf commented Jul 10, 2019

Release date would be later this week or next week, depends on the other fixes that are waiting to be verified.

@estruyf
Copy link
Member

estruyf commented Jul 18, 2019

This is now included within the 1.14.0 release

@estruyf estruyf closed this as completed Jul 18, 2019
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