Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Page crashes when modifying data #23

Open
marcoveeneman opened this issue Dec 14, 2019 · 8 comments
Open

Page crashes when modifying data #23

marcoveeneman opened this issue Dec 14, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@marcoveeneman
Copy link
Contributor

marcoveeneman commented Dec 14, 2019

Hi,

First of all, thanks for this awesome starter, it looks very promising.

While experimenting locally i encountered a very annoying issue. When modifying the site configuration via pencil > hamburger menu > Site the page crashes with the following error when updating the site title TypeError: null is not an object (evaluating 'data.site.title'). It does not matter if i add, remove or replace characters, the page crashes for any action. The same goes for the other fields.

I also checked if similar crashes occur at other places on the site and they do. For example when updating the title or the link of a menu item: TypeError: null is not an object (evaluating 'menu.menuItems').

To me it looks like before the new value gets assigned, it becomes null first, causing crashes when the null value is used before it is updated to the new value.

Is this a known issue or can it have something to do with my setup? Like it is now it is impossible to use. Reloading the page after the crash makes the page load again.

I'm using node v12.13.1, Gatsby CLI 2.8.18, Safari on macOS Catalina, commit 6d675bd. If you need anything else just let me know.

@iamchanii
Copy link

iamchanii commented Dec 21, 2019

It's looks like same issue what I face. when I try to change form data, my application got crash. because, json result what returned from useStaticQuery is null.

@iamchanii
Copy link

To check what happened...
image
image

@iamchanii
Copy link

and here is my repository that has a same issue: https://github.com/iamchanii/gatsby-tinacms-example (this is made for wrote my blog post. please consider that contains language not english.)

@spbyrne
Copy link
Contributor

spbyrne commented Dec 21, 2019

Thanks for the extra info on this issue! I'll troubleshoot and see if I can come up with a fix.

@spbyrne
Copy link
Contributor

spbyrne commented Dec 21, 2019

I have a fix for this that's working for me locally, I've pushed the fix to master.

In form definitions where null returns are creating an issue I've made them return a blank string instead of null by adding a custom parser to the form definition like so:

{
  label: "Title",
  name: "rawJson.title",
  component: "text",
  parse(value) {
    return value || ""
  },
},

I was able to recreate the error described above and this fix seemed to work for me. Once you merge in this change I'd recommend running gatsby clean before gatsby develop.

Let me know if this works! 😄

@spbyrne spbyrne added the bug Something isn't working label Dec 21, 2019
@iamchanii
Copy link

iamchanii commented Dec 22, 2019

1c3c887 commit works. can you try yarn upgrade --latest? then try gatsby clean && gatsby develop. it looks like not resolved. maybe caused by latest packages. on my case, I set up manually so I used latest packages.

@iamchanii
Copy link

I guess something is not compatible with latest gatsby. I test my repository with [email protected] and work for me.

iamchanii added a commit to iamchanii/gatsby-tinacms-example that referenced this issue Dec 23, 2019
@TrueMarketing
Copy link

For anyone who is using Netlify and getting the error Field "image" must not have a selection since type "String" has no subfields on build, I made the elementary mistake of not pushing the images I was working with locally to my git repo.

Check to see if this is the issue using git status on your repo.

Thanks for this AMAZING starter. This is a true game-changer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants