`gatsby-source-contentful` returns a string with a single whitespace character (`" "`) for empty "long text" fields
See original GitHub issueDescription
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](https://user-images.githubusercontent.com/24367010/72275526-004e2580-3626-11ea-92ef-6746a349fdc1.png)
Steps to reproduce
- Create new Gatsby project
- Install and configure
gatsby-source-contentful
- Create an entry in Contentful with a “long text” field
- Leave “long text” field empty
- 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:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Awesome! I can do that 🙌
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! 💪💜