pnp / pnp/sp-dev-fx-controls-react
DynamicForm Bug with PeoplePicker (one person)
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
Please specify what version of the library you are using: [3.20 ]
Expected / Desired Behavior / Question
Observed Behavior
When using DynamicForm's fieldOverrides with a PeoplePicker control with when you save the record the user field will remain blank. There are no errors thrown. The issue is when calling the onChanged event in the switch case 0 block the line
if (!(newValue[0].id === undefined || parseInt(newValue[0].id, 10).toString() === "NaN")) return [3 /break/, 2];
will result in not(false) = true when a user is populated which will return [3 /break/, 2] therefore leaving the user blank when saved.
I changed the line to this
if (newValue[0].id === undefined || parseInt(newValue[0].id, 10).toString() === "NaN") return [3 /break/, 2];
which resolved the issue and now the user is saved.
Steps to Reproduce
- Make sure your list has a User field for one person only.
- Create a SPFx Form Customizer extension solution using REACT.
- Install @pnp/spfx-controls-react
- Use the DynamicForm control and use fieldOverrides to create your own PeoplePicker control (personSelectionLimit=1).
- Deploy or run in workbench and enter a user and click Save. The form will save but the User field will be blank.
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 at the DynamicForm control's fieldOverrides PeoplePicker entry point and trace its onChanged handler, especially the switch case 0 condition described in the issue. Reproduce the one-person User field scenario, then verify that saving a selected user persists the value instead of leaving the field blank.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100