pnp / pnp/sp-dev-fx-controls-react

ListItemPicker : when props are updated the selected items are always reset event if it should not

Open
#2,008 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.