gatsby-uc / gatsby-source-strapi

Gatsby source plugin for building websites using Strapi as a data source
MIT License
354 stars 182 forks source link

single type does not merge - can't query all locales #291

Closed leduchung closed 2 years ago

leduchung commented 2 years ago

I am using version 2.0.0-beta.0, so the code is in new syntax.

As you may know, the param locale=all does not work in Strapi, so the workaround to get all languages of a single type can be done like below:

singleTypes: [
          { singularName: 'home-page', queryParams: { locale: 'en' } },
          { singularName: 'home-page', queryParams: { locale: 'it' } },
          { singularName: 'home-page', queryParams: { locale: 'de' } }
        ],

The previous version works by merging all results into one, but now it only fetches the first entry (shown at build time).

Does anyone have an idea of how to fix it?

jonathan-baernthaler commented 2 years ago

@remidej thanks for looking into this! I am having the exact same issue at the moment. Do you have any updates on this? @leduchung did you find any workaround for this issue already?

leduchung commented 2 years ago

@jonathan-baernthaler I don't have any working solution at the moment. I have to either wait for the plugin to be fixed, or wait for the Strapi issue to be merged (https://github.com/strapi/strapi/issues/12638).

remidej commented 2 years ago

Hello, we have identified the issue and decided on the best way to fix it. You can expect a fix release next week

daton89 commented 2 years ago

@remidej will you provide a fix for the version 3 and 4 😄 ?

jonathan-baernthaler commented 2 years ago

Hello, we have identified the issue and decided on the best way to fix it. You can expect a fix release next week

@remidej thanks that would be great. 👏

jonathan-baernthaler commented 2 years ago

@jonathan-baernthaler I don't have any working solution at the moment. I have to either wait for the plugin to be fixed, or wait for the Strapi issue to be merged (strapi/strapi#12638).

I found a solution that is rather cumbersome but works for now. You are able to pull in the data via the gatsby-node.js (like the plugin does) and use custom graphql queries for your specific use case. Maybe something you want to look into

jonathan-baernthaler commented 2 years ago

@remidej another thing: I saw that you are working on the strapi-corporate-starter and its respective frontends with next and gatsby! first off great work! I really like the architecture, we are going to use its concepts for a project now.

but as you are aware v4 of strapi broke both frontends. Is it something that's going to be actively maintained in the future again?

remidej commented 2 years ago

Thanks @jonathan-baernthaler

We have ported the Next corporate starter on this repo. I don't know when we'll port the Gatsby version though.

remidej commented 2 years ago

This is implemented in the v2.0.0 stable release. See this section of the readme