Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[gatsby-source-contentful] Added support for non localized fields without use of fallback locales #7854

Conversation

stoltzrobin
Copy link
Contributor

Fixes for #2937, default locale is added to support a contentful setup where fallback locales are not used.

Test case

A content model existing of 2 fields (the environment is setup without having any fallbacks.

  • Name (localized)
  • slug (not localized)

Result from graphQL query

{
  "data": {
    "allContentfulPage": {
      "edges": [
        {
          "node": {
            "name": "Page A",
            "node_locale": "en-US",
            "slug": "/"
          }
        },
        {
          "node": {
            "name": "Page B",
            "node_locale": "es-ES",
            "slug": null
          }
        },
      ]
    }
  }
}

Expected Result

{
  "data": {
    "allContentfulPage": {
      "edges": [
        {
          "node": {
            "name": "Page A",
            "node_locale": "en-US",
            "slug": "/"
          }
        },
        {
          "node": {
            "name": "Page B",
            "node_locale": "es-ES",
            "slug": "/"
          }
        },
      ]
    }
  }
}

@pieh
Copy link
Contributor

pieh commented Sep 4, 2018

@Khaledgarbaya is this change a valid behaviour change? I don't know enough about contentful localization setup to make that call.

@pieh pieh requested a review from Khaledgarbaya September 4, 2018 11:47
@Khaledgarbaya
Copy link
Contributor

Hey @stoltzrobin,
can you add some test so I get to see the problem better?

Best,
Khaled

Copy link
Contributor

@Khaledgarbaya Khaledgarbaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pieh pieh merged commit f30f0b1 into gatsbyjs:master Sep 5, 2018
@gatsbot
Copy link

gatsbot bot commented Sep 5, 2018

Holy buckets, @stoltzrobin — we just merged your PR to Gatsby! 💪💜

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (Currently we’ve got a couple t-shirts available, plus some socks that are really razzing our berries right now.)
  2. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants