The page exceeds the baseline number of recommended calls to SharePoint.

Brass Contributor

Hi!
When I am opening my homepage, it started refreshing several times.
I decided to run diagnostic the page and here are the results:

Screenshot_476.png

I opened the "This page has 27 calls to SharePoint" tab and noticed several duplicate calls to the API.

Screenshot_477.png

Could you tell me please if exceeding the number of recommended calls can lead to a page refreshing?

And what do these APIs mean?
https://abc.sharepoint.com/sites/ABC/_api/web/GetClientSideComponents

3 Replies

@Pavel2235 Are you using any custom SPFx web parts on this SharePoint page? 

 

/_api/web/GetClientSideComponents API call is for loading the web parts in the web part toolbox on SharePoint pages.

 

SourceMicrosoft Graph Developer Proxy v0.7 with extended configuration options and improved simulating thr... 


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

@ganeshsanap Yes, I'm using graph api to get users from Azure AD and render at the webpart. 

 

public getAllUsers(): Promise<Array<Person>> {
    return graph
      .users
      .select("givenName", "surname", "employeeHireDate", "id", "userPrincipalName", "jobTitle", "companyName",  "createdDateTime")
      .get({
        headers: { ConsistencyLevel: "eventual" }
      })
      .then((usersList) => {
        return usersList.map((item: any) => {
          return {
            id: item.id,
            firstName: item.givenName,
            lastName: item.surname,
            email: item.userPrincipalName,
            userId: Number(item.id),
            eventDate: moment(item.createdDateTime),
            eventType: "New Arrival",
            type: "newcomer",
            jobTitle: item.jobTitle,
            photoUrl: `${this._ctx.pageContext.web.absoluteUrl}/_layouts/15/userphoto.aspx?size=M&accountname=${item.userPrincipalName}`,
          };
        });
      });
  }

 

This service I initialized in webpart .ts :

 

public onInit(): Promise<void> {
    return super.onInit().then(_ => {
      sp.setup({
        spfxContext: this.context as any
      });
    });
  }

  public render(): void {
    const service = new PersonService(this.properties.timeIntervalToDisplay, this.context);
    const element: React.ReactElement<INewComersProps> = React.createElement(
      NewComers,
      {
        description: this.properties.description,
        context: this.context,
        service: service,
        profilePageUrl: this.properties.profilePageUrl,
        person: this.properties.person,
        title: this.properties.title,
        seeAllLink: this.properties.showAllLink,
        showAll: this.properties.showAll,
        isOpenInNewTab: this.properties.shouldOpenNewTab,
        displayNumber: this.properties.numberOfItemsToDisplay
      }
    );
    ReactDom.render(element, this.domElement);
  }

 

And in the component I call this service and set values in the componentDidMount():

 

public componentDidMount(): void {
    this.loadData().then(data => {
      this.setState({
        items: data,
        isLoaded: true
      });
    }).catch(error => { console.error(error); });
  }

private loadData(): Promise<Array<Person>> {
    return this.props.service.getAllUsers().then((result: Array<Person>) => {
      return result.sort((b, a) => a.eventDate.valueOf() - b.eventDate.valueOf());
    });
  }

 

 I have only one request after loading the page.
Screenshot_492.png
Strange then, why is the diagnostic showing multiple calls to this api /_api/web/GetClientSideComponents?

@Pavel2235 These API calls are by Microsoft SharePoint itself for fetching the web parts in the web part tool box.

 

Those web parts are loaded from Client Side Components library in the app catalog site. I don't think you will be able to reduce these SharePoint default API calls on the pages.


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.