pnp / pnp/sp-dev-fx-controls-react
How can I clear the selected Persons in the PeoplePicker component?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 433
- Forks
- 418
- Avg merge
- 5d 6m
- Merged PRs (30d)
- 19
Description
Category
[ ] Enhancement
[ ] Bug
[x] Question
Version
Please specify what version of the library you are using: [3.9.0]
I can not upgrade to the latest version 3.10.0, because in that version the PeoplePicker is broken. See: https://github.com/pnp/sp-dev-fx-controls-react/issues/1292
Question
How can I clear the selected Persons in the PeoplePicker component?
I found a solution, that works. By creating a ref to the PeoplePicker and then doing.
peoplePickerRef.current.setState({ ...peoplePickerRef.current.state, selectedPersons: [] });
However, I read that state should only be updated by the component itself, and props should only be updated by other components. So setting the state from another component does not seem to be a good way to go.
It seems that there used to be a prop selectedPersons on the PeoplePicker, which I could use to solve this Problem. But in my version this does not work, as typescript is complaining, that this prop does not exist on the PeoplePicker component.
Any hints are appreciated, like was this prop really removed? Is there a new way to handle clearing the selected Persons?
Thanks for any help in advance!
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 by reviewing the PeoplePicker public API and the selected-person handling described in the issue for versions 3.9.0 and 3.10.0. Confirm whether a supported clearing mechanism exists and define the expected behavior before making any change; the payload names no source file or test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100