pok
pok

Reputation: 3

Empty CMS content slot in SSR in Spartacus / SAP Composable storefront

In my Spartacus/Composable Storefront project there is an issue that happens when opening a page in SSR while being logged in.

It seems that for some reason there is some missing CMS component data and as a result the ... is empty in the DOM and I don't see the "MyAccountComponent" CMS component that should be displayed in the top header.

When I then navigate to e.g. Product Page then suddenly the missing component appears in the DOM and on the page. Also at the same time when navigating to PDP I can see that a new request to OCC /cms/pages endpoint is sent which in the response among other things includes the CMS components data for the "HeaderLinks" slot.

screenshot of network tab with request to "/cms/pages" endpoint

So it looks that the initial SSR page for some reason does not contain the data about the CMS components that should be inside this HeaderLinks slot.

When I open pages in CSR there is no problem and I can see the link so it seems this is a problem related with SSR.

Any suggestions?

I already added the ssrTransfer configuration like below but that didn't change anything:

 provideConfig({
      state: {
        ssrTransfer: {
          keys: {
            [CMS_FEATURE]: StateTransferType.TRANSFER_STATE,
            [PRODUCT_FEATURE]: StateTransferType.TRANSFER_STATE,
            [SITE_CONTEXT_FEATURE]: StateTransferType.TRANSFER_STATE,
          },
        },
      },
    }),

Upvotes: 0

Views: 21

Answers (0)

Related Questions