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
388 stars 341 forks source link

Multiplying calls to _api/site?$select=IsHubSite,HubSiteId,Id #3999

Open tom-daly opened 2 months ago

tom-daly commented 2 months ago

Version used Ex: 4.13.1.0

Describe the bug The more verticals and more results on the page the webparts multiplies the number of calls to _api/site?$select=IsHubSite,HubSiteId,Id

This is resulting in very long search times for highly customized pages.

To Reproduce 1 Search Box & 1 Results = 1 call image

1 Search Box, 1 Search Vertical [All] & 1 Results [Configured to all Vertical] = 4 calls image

1 Search Box, 7 Search Verticals & 7 Results [1 per vertical] = 37 calls image

I've tried default webparts with no special queries and its the same the number of calls seems to multiply but the number of items.

switch vertical - it makes 16 more requests 2024-09-20_13-04-45

Expected behavior when the webpart is loaded grab this value ahead of time or cache it.

Screenshots see above

Desktop (please complete the following information):

Additional context

kasperbolarsen commented 2 months ago

@patrikhellgren just a guess without any proof: Could this be a side effect of the audience targeting in the verticals?

patrikhellgren commented 2 months ago

@kasperbolarsen After checking the code it doesn't seem to have anything to do with that. I can reproduce the issue but not all the time so I will have a look at what could be causing this and post back here.