Skip to content

Conversation

@NishkalankBezawada
Copy link
Contributor

Q A
Bug fix? [x]
New feature? [ ]
New sample? [ ]
Related issues? fixes #1669

What's in this Pull Request?

Fixing issue - 1669 - PeoplePicker returns no results with webAbsoluteUrl and ensureUser

Problem statement

When setting webAbsoluteUrl prop to a different site and property to ensureUser = true, results are expected to be returned.
But, No results are fetched, If both the webAbsoluteUrl prop is pointing to a different site than the current one, and ensureUser is set to true, no results are returned in the picker. Instead, the console shows the error: PeopleSearchService::searchTenant: error occured while fetching the users.

272968786-c5580105-3c8c-4551-b143-28220b756b01

A deeper error says Cannot read properties of undefined (reading 'push'), which I've tracked down to PeopleSearchService.ensureUser:295. The object cachedLocalUsers assumes it already contains the webAbsoluteUrl as a key but it does not.

Solution

When checked, in the method ensureUser, the user object is pushed into this.cachedLocalUsers. But this is empty because the user is given webAbsoluteUrl to fetch the users from other site collection, for which it is erroring out as Cannot read properties of undefined (reading push) as shown in the below figure.

image

By checking if this.cachedLocalUsers and initializing it as empty array (as below), this is working as expected.

image

Screenshot with working example

Issue 1669

Thanks,
Nishkalank Bezawada

@NishkalankBezawada
Copy link
Contributor Author

Hello @michaelmaillot @joelfmrodrigues

Kindly review this PR and let me know your comments.

Thanks,
Nishkalank

@michaelmaillot
Copy link
Collaborator

Thanks @NishkalankBezawada, we'll review this PR shortly!

@michaelmaillot michaelmaillot self-assigned this Feb 3, 2024
@michaelmaillot michaelmaillot merged commit cf2a4d2 into pnp:dev Feb 3, 2024
@michaelmaillot
Copy link
Collaborator

PR merged, thank you!

@michaelmaillot michaelmaillot added this to the 3.17.0 milestone Feb 3, 2024
@NishkalankBezawada NishkalankBezawada deleted the Issue-1669-New branch February 12, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants