Section model state (data connected) not populated in get("page" ..) when Page references a section

Builder content link

Builder public api key
60f9f6f2dd41464e9bc583d3c22ff12f

What are you trying to accomplish
Retrieve the entire content of a page in one query to builder.io

The page model is having a Reference to a Section (topBar). The topBar Section has data connected, an structured content model siteMap.

When I get the page with get("page", { enrich: true }), it brings correctly the topBar model reference. However, the connected data in the topBar content is not resolved, it stays in data.httpRequests instead of appearing in data.state.siteMap

If I execute get("top-bar", ...) it does bring the data evaluated in data.state.siteMap.

(Please note I can do this second call and have this issue resolved, it’s just trying to do it in one shot :slight_smile:

Screenshots or video link
none

Code stack you are integrating Builder with
NextJS, react

Reproducible code example

// This function is used by the page to get the sections to render
// from the builder.io API (CMS)
export async function getPageSections(paths: string[], useSingleCall:boolean = false ):Promise<PageSections> {
  const pageModel = await builder.get("page", {
    enrich: useSingleCall,
    includeRefs: useSingleCall,
    userAttributes: {
      urlPath: "/" + (paths?.join("/") || ""),
    },
  }).toPromise();
    
  if (pageModel?.data?.topBar.id) {
    if (useSingleCall) {
      return {
        body: pageModel,
        topBar: pageModel.data?.topBar?.value,
      }
    }
    const topBar = await builder.get("top-bar", {
      query: {
        "id": pageModel.data.topBar.id
      },
    }).toPromise();
    return {
      body: pageModel,
      topBar: topBar,
    }
  }

  if (pageModel) {
    return {
      body: pageModel,
      topBar: null,
    }
  }

  // secondly, it might be a section only to be rendered
  // this point is only reached when designing a section
  const topBar = await builder.get("top-bar", {
      userAttributes: {
        urlPath: "/" + (paths?.join("/") || ""),
      },
    })
    .toPromise();
  
  return {
    body: null,
    topBar: topBar
  }
}

Hello @osangenis-builder,

Using includeRefs seems to return the appBar reference model values, can you give that a try

https://cdn.builder.io/api/v3/content/page?apiKey=60f9f6f2dd41464e9bc583d3c22ff12f&limit=10&omit=data.blocks&includeRefs=true