microsoft-search / pnp-modern-search

Home of PnP Modern Search solutions, helping you move from classic to modern SharePoint and beyond
https://microsoft-search.github.io/pnp-modern-search
Other
387 stars 340 forks source link

Persona Card - To many request Graph #875

Closed ronbet closed 1 year ago

ronbet commented 3 years ago

Version used 4.0

Describe the bug Using People layout with SharePoint People Result, people is displayed correctly. After activating the Persona Hover Card with correct approved API permission - The hover function is not working. There is 7000+ user and the error from the web console is "To many request (429) microsoft graph. It seem to be all user called om search at one user and no reaction in network traffic when hover the inactivate persona card.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

wobba commented 3 years ago

@FranckyC is this all on graph toolkit?

FranckyC commented 3 years ago

@wobba Yes the persona card is implemented through MGT, we need to check what queries are made when hover.

fisketryne5 commented 3 years ago

Any update on this? I am having the same problem. (~5000 searchable users.)

wobba commented 3 years ago

When no updates have been added to an issue, it means no one in the community has looked at it yet :)

stevebeauge commented 3 years ago

Also experiencing this very annoying issue.

Looking in the network reveal that for each personna in the search result, Two requests are emitted. A first using the OPTIONS verb, and a second using a GET verb. Both pointing to https://graph.microsoft.com/v1.0/me/people?$search=%22someemail@corp.com%22.

In my case, I have a people search that shows 30 results. This means each time the page loads, 60 requests is made.

Any advise or workaround ?

Maybe the details fershing should be move to the hover or click event instead of the page load ?

Or maybe the MGT can handle batch requests ?

wobba commented 3 years ago

Seems that when adding the onhover card functionality the graph toolkit will fire off the graph query per item before hovering via the <mgt-person> component. Not sure there's any way we can fix that.

stevebeauge commented 3 years ago

I also noticed there's no caching with the search WP.

In the mgt doc, a caching mechanism is described and should appears in the local indexdDB.

In my environment, I don't see the expected cache DB.

Not clear if it's supposed to be enabled by default thought.

It won't solve first load performance issue, but I guess it wouldn't arm ?

wobba commented 3 years ago

@stevebeauge adding cache seems like a smart thing to do :)