question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`gatsby-source-contentful` returns a string with a single whitespace character (`" "`) for empty "long text" fields

See original GitHub issue

Description

gatsby-source-contentful returns a string with a single whitespace character (" ") for empty “long text” fields, rather than an empty string (""), or null like other fields. Seems to be fine and returns null for empty “short text” fields.

It looks like the problem stems is on this line, though not sure if this space is there for a reason or not 🤔 - haven’t had time to investigate that thoroughly yet.

image

Steps to reproduce

  1. Create new Gatsby project
  2. Install and configure gatsby-source-contentful
  3. Create an entry in Contentful with a “long text” field
  4. Leave “long text” field empty
  5. Run Gatsby site and query the entry/field in GraphiQL editor

Expected result

"description": null

is returned

Actual result

"description": {
  "description": " "
}

is returned

Environment

Run gatsby info --clipboard in your project directory and paste the output here.


  System:
    OS: macOS 10.15.2
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.16.2 - /var/folders/c6/zn3s5lkd09xf78n8tcylhyg00000gn/T/yarn--1578935140235-0.22327134046771624/node
    Yarn: 1.21.1 - /var/folders/c6/zn3s5lkd09xf78n8tcylhyg00000gn/T/yarn--1578935140235-0.22327134046771624/yarn
    npm: 6.13.4 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 79.0.3945.117
    Firefox: 72.0.1
    Safari: 13.0.4
  npmPackages:
    gatsby: 2.16.3 => 2.16.3 
    gatsby-image: 2.2.29 => 2.2.29 
    gatsby-plugin-react-helmet: 3.1.11 => 3.1.11 
    gatsby-plugin-segment-js: 3.0.1 => 3.0.1 
    gatsby-plugin-styled-components: 3.1.14 => 3.1.14 
    gatsby-plugin-typescript: 2.1.12 => 2.1.12 
    gatsby-source-contentful: 2.1.47 => 2.1.47 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mrseanbainescommented, Feb 12, 2020

Awesome! I can do that 🙌

1reaction
github-actions[bot]commented, Feb 9, 2020

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label “not stale” to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

Read more comments on GitHub >

github_iconTop Results From Across the Web

Check if Swift text field contains non-whitespace
This answer was last revised for Swift 5.2 and iOS 13.5 SDK. You can trim whitespace characters from your string and check if...
Read more >
Long Text Area Field check for null - Salesforce Stack Exchange
If you want to check whether it is not blank, then use String.isNotBlank(insuranceRecord.Comments_Private__c).
Read more >
Jira smart values - text fields - Atlassian Documentation
Returns the position of the first character in the specified text in the ... Checks to see if the text is empty and...
Read more >
String.IsNullOrWhiteSpace(String) Method (System)
Indicates whether a specified string is null, empty, or consists only of white-space characters.
Read more >
String.IsNullOrWhiteSpace - BlackWasp
When working with user input it is common to check that a string has ... such a string is null, empty or contains...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found