pnp / pnp/sp-dev-fx-controls-react
ListItemPicker : when props are updated the selected items are always reset event if it should not
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 433
- Forks
- 418
- Avg merge
- 5d 6m
- Merged PRs (30d)
- 19
Description
Category
[ ] Enhancement
[X] Bug
[ ] Question
Version
3.21.0
Expected / Desired Behavior / Question
When props are updated, this.state.selectedItems is erased evetn if it shoud not.
Observed Behavior
If a property the disabled is updated from true to false, all items are shown in the suggested list even the those from defaultSelectedItems.
Steps to Reproduce
Create the picker with default values and with the disabled property set to true. The update the property disabled to false.
Submission Guidelines
In the file ListItemPicker.tsx in the function UNSAFE_componentWillReceiveProps replace the first line
let newSelectedItems: any[] | undefined; by let newSelectedItems = this.state.selectedItems;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ListItemPicker.tsx at UNSAFE_componentWillReceiveProps and inspect how selectedItems is handled when the disabled prop changes. Update the initialization as described in the issue, then verify that items from defaultSelectedItems remain selected and are not shown in the suggested list after disabled changes from true to false.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100