Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PeoplePicker returns no results with webAbsoluteUrl and ensureUser #1669

Closed
argofgra opened this issue Oct 5, 2023 · 5 comments · Fixed by #1757
Closed

PeoplePicker returns no results with webAbsoluteUrl and ensureUser #1669

argofgra opened this issue Oct 5, 2023 · 5 comments · Fixed by #1757
Assignees
Labels
status:fixed Issue fixed in current or prior release. type:bug
Milestone

Comments

@argofgra
Copy link

argofgra commented Oct 5, 2023

Category

[ ] Enhancement

[X] Bug

[ ] Question

Version

Please specify what version of the library you are using: [ 3.15.0 ]

Expected / Desired Behavior / Question

When setting webAbsoluteUrl prop to a different site and setting ensureUser = true results are expected to be returned.

Observed Behavior

No results are returned.
image

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.

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.

Steps to Reproduce

  1. Add PeoplePicker control to a component
  2. Provide a webAbsoluteUrl value that points at a different site than the current one
  3. Set ensureUser={true}
  4. Attempt to search for users in the people picker
@ghost
Copy link

ghost commented Oct 5, 2023

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

@ghost ghost added the Needs: Triage 🔍 label Oct 5, 2023
@github-actions
Copy link

github-actions bot commented Oct 5, 2023

Thank you for submitting your first issue to this project.

@NishkalankBezawada
Copy link
Contributor

Hello @argofgra

I replicated the issue. I will be creating a PR on this soon.

@joelfmrodrigues or @AJIXuMuK kindly assign this to me.

Thanks,
Nishkalank Bezawada

@NishkalankBezawada
Copy link
Contributor

Hello @argofgra

I have created a PR #1693 which will resolve the issue.

The solution is as below.

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

@michaelmaillot michaelmaillot added status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. type:bug and removed Needs: Triage 🔍 labels Nov 5, 2023
@michaelmaillot michaelmaillot added this to the 3.17.0 milestone Feb 3, 2024
@michaelmaillot michaelmaillot added status:fixed-next-drop Issue will be fixed in upcoming release. and removed status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. labels Feb 3, 2024
@michaelmaillot
Copy link
Collaborator

Hi @argofgra & @NishkalankBezawada, fix has been merged to dev branch, it should be available soon in the next beta release!

Thanks to both of you 🙂

@joelfmrodrigues joelfmrodrigues mentioned this issue Feb 5, 2024
@joelfmrodrigues joelfmrodrigues added status:fixed Issue fixed in current or prior release. and removed status:fixed-next-drop Issue will be fixed in upcoming release. labels Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed Issue fixed in current or prior release. type:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants