storyblok / storyblok-nuxt-2

6 stars 8 forks source link

The "story" object data does not appear in the multilink in SSR response. #68

Open dmytrokravch opened 2 years ago

dmytrokravch commented 2 years ago

Hello,

I don't know if is this a problem with my config or a general problem with the SDK, because I didn't find the solution in your documentation and issues.

I want to use the "story" object data from "fieldtype": "multilink" for a multilanguage setup. And I saw that the "story" object does not appear on the server-side calls, I can see it only on the client-side.

Here is the example of storyblokApi response for both sides: server side response:

{
  id: 'c2aa9ba3-572e-4aab-b9f1-90e7fb9e2bf6',
  url: '',
  linktype: 'story',
  fieldtype: 'multilink',
  cached_url: 'oferta/'
}

client-side response

{
    "id": "c2aa9ba3-572e-4aab-b9f1-90e7fb9e2bf6",
    "url": "",
    "linktype": "story",
    "fieldtype": "multilink",
    "cached_url": "oferta/",
    "story": {
        "name": "Oferta",
        "id": 206177576,
        "uuid": "c2aa9ba3-572e-4aab-b9f1-90e7fb9e2bf6",
        "slug": "oferta",
        "url": "oferta/",
        "full_slug": "oferta/",
        "_stopResolving": true
    }
}

nuxt.config.js:

buildModules: [
    ['@storyblok/nuxt-2/module', {
      accessToken: '***'
    }],
    '@nuxtjs/pwa',
    '@nuxtjs/composition-api/module',
    '@nuxt/typescript-build',
    'nuxt-lazy-load',
    '@nuxtjs/sitemap'
  ],

package.json

  "dependencies": {
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/composition-api": "^0.33.1",
    "@nuxtjs/i18n": "^7.3.0",
    "@nuxtjs/pwa": "^3.3.5",
    "@nuxtjs/sitemap": "^2.4.0",
    "@storyblok/nuxt-2": "^1.2.1",
    "core-js": "^3.25.3",
    "nuxt": "^2.15.8",
    "nuxt-lazy-load": "^1.2.9",
    "sass": "^1.55.0",
    "sass-loader": "10.1.1",
    "vue": "^2.7.10",
    "vue-server-renderer": "^2.7.10",
    "vue-slick-carousel": "^1.0.6",
    "vue-template-compiler": "^2.7.10"
  },

Thanks in advance!

Dawntraoz commented 1 year ago

Hi, @dmytrokravch, It's possible to see your code, or can you please provide the code that you're using for calling the API in your Nuxt application? Are you using asyncData to encapsulate the call?

PS: If you think it will be easier to show me in a call, we can plan one and check it together, then I can make a summary here.

egrossnickle commented 1 year ago

@dmytrokravch @Dawntraoz Did you ever figure this out? I'm seeing the same issue after updating to 1.2.x — never saw the issue with <= 1.1.0.