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

Cannot read properties of undefined (reading 'User') to set PeoplePicker principalTypes

Open
#1,235 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Needs: Attention :wave:
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.7 & 3.8.0 ]

Expected / Desired Behavior / Question
 import {PeoplePicker, PrincipalType} from "@pnp/spfx-controls-react/lib/PeoplePicker";
 <PeoplePicker 
    context={props.spfxContext}
    titleText={'Select user'}
    ensureUser={true}
    principalTypes={[PrincipalType.User]}
    showHiddenInUI={false}
    resolveDelay={500}
/>

PeoplePicker always get

Uncaught TypeError: Cannot read properties of undefined (reading 'User')

But if I change the import statement to
import {PeoplePicker, PrincipalType} from "@pnp/spfx-controls-react/lib/controls/peoplepicker";
The PeoplePicker rendered successfully.

The spfx version is 1.14, the pnp/sp version is 3.4.1, I also installed "rush-stack-compiler-4.2"(This is required by pnpjs v3).
I am working on SharePoint Online with a mac mini.

I had make a similar demo with pnpjs v2 and rush-stack-compiler-3.9, the PeoplePicker worked well. But I cannot make sure this is caused by rush-stack-compiler.

So whether this is compatible with pnpjs v3, or I have missed something?

Thanks!

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

Reproduce the error using the @pnp/spfx-controls-react/lib/PeoplePicker import and the working @pnp/spfx-controls-react/lib/controls/peoplepicker import shown in the report. Check how PeoplePicker and PrincipalType are exported for the stated SPFx, PnPjs, and compiler versions; done when the documented import works or the incompatibility is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.