You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @calag4n, I don't know the exact reason why this is happening but seems like this issue is similar to the issue where window is not available during server side rendering (when gatsby build is run)
here's a work around :-
// layout.jsconstLayout=({ children, foo })=>{constbar=foo&&foo.length;// if foo exists then access foo.length;}
Wow !
I stucked on this the entire last night, over-thinking some weird ways to fix it.
Then, barely two hours after I report that issue you come with the simpliest way to solve this ^^' .
I found out that is some others prototype methods wich end up the same error (like Array.slice()).
Description
Build fails if I try to get the
length
property of a string passed from parent through props.Same error occurs localy and on netlify deploy.
Steps to reproduce
Install a starter
$ gatsby new gatsby-starter-default https://github.com/gatsbyjs/gatsby-starter-default
Create a string variable in index page
Get its length in a child component
Build
$ yarn build
Expected result
Build complete
Actual result
Environment
The text was updated successfully, but these errors were encountered: