pnp / sp-dev-fx-controls-react

Reusable React controls for SPFx solutions
https://pnp.github.io/sp-dev-fx-controls-react/
MIT License
385 stars 379 forks source link

PNPJS Dynamic Form - User Type control renders arbitrary value when blank #1404

Open murtuzamj opened 1 year ago

murtuzamj commented 1 year ago

Category

[ ] Enhancement

[X] Bug

[X] Question

Version

Please specify what version of the library you are using: [ "@pnp/spfx-controls-react": "3.11.0" ]

Expected / Desired Behavior / Question

Renders a dummy/arbitrary username

Observed Behavior

Expected is a blank / null value

Steps to Reproduce

  1. Add SPFX controls react to your webpart
  2. Add DynamicForm Control
  3. Create a list with People Picker Field
  4. Set List ID in the Dynamic Form Control
  5. run webpart on workbench

Thanks!

ghost commented 1 year ago

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

github-actions[bot] commented 1 year ago

Thank you for submitting your first issue to this project.

AJIXuMuK commented 1 year ago

@murtuzamj - could you please provide your code? What are the properties you're setting for the DynamicForm. I can't repro the issue. Maybe you have a field override with a placeholder?

murtuzamj commented 1 year ago

grafik

Hey, thanks for looking into the issue, please check the screenshot, Since there is no logic to show only specific fields, I had to write my own logic to show visible fields, using the hiddenfields attribute, but that is fine.

The only problem is that it renders a default value in the people picker field somehow.

S1mpleLim3 commented 1 year ago

I am also facing similar issue, when there is people column is empty in SP, it renders arbitary value in peoplepicker when listItemId is provided.

murtuzamj commented 1 year ago

I did find the issue reason, it passes "null" as a query string, if a user has "null" in his name, which is rare but possible in huge organizations, it renders that users entry in people picker.

I verified that I am using V 3.12.0 spfx controls react and the issue still persists.

unfortunately, I had to remove the user using UI click,

document.querySelector(".ms-PickerItem-removeButton")["click"]();