news-catalyst / next-tinynewsdemo

Frontend for Tiny News Collective organizations
https://next-tinynewsdemo.vercel.app
1 stars 0 forks source link

Bug on SectionLink on newly bootstrapped site #781

Closed jacqui closed 3 years ago

jacqui commented 3 years ago

I'm guessing this is because the site hasn't been properly configured yet:

TypeError: Cannot read property 'SectionLink' of undefined
    at eval (webpack-internal:///./components/nav/GlobalNav.js:155:87)
    at me (/Users/jacqui/Projects/newscatalyst/frontend-site/node_modules/styled-components/dist/styled-components.cjs.js:1:14816)
    at e.generateAndInjectStyles (/Users/jacqui/Projects/newscatalyst/frontend-site/node_modules/styled-components/dist/styled-components.cjs.js:1:11837)
    at /Users/jacqui/Projects/newscatalyst/frontend-site/node_modules/styled-components/dist/styled-components.cjs.js:1:18281
    at /Users/jacqui/Projects/newscatalyst/frontend-site/node_modules/styled-components/dist/styled-components.cjs.js:1:18425
    at Object.I [as render] (/Users/jacqui/Projects/newscatalyst/frontend-site/node_modules/styled-components/dist/styled-components.cjs.js:1:18871)
    at ReactDOMServerRenderer.render (/Users/jacqui/Projects/newscatalyst/frontend-site/node_modules/react-dom/cjs/react-dom-server.node.development.js:3872:44)
    at ReactDOMServerRenderer.read (/Users/jacqui/Projects/newscatalyst/frontend-site/node_modules/react-dom/cjs/react-dom-server.node.development.js:3690:29)
    at renderToString (/Users/jacqui/Projects/newscatalyst/frontend-site/node_modules/react-dom/cjs/react-dom-server.node.development.js:4298:27)
    at renderPage (/Users/jacqui/Projects/newscatalyst/frontend-site/node_modules/next/dist/next-server/server/render.js:53:854)

The error refers to the following lines:

const SectionLink = styled.a(({ meta }) => ({
  ...tw`lg:items-center lg:mr-8 lg:py-0 inline-flex items-end h-full py-2 px-5 lg:pb-0 lg:px-0`,
  fontFamily: Typography[meta.theme].SectionLink,
}));

I'm going to check if the meta.theme isn't set.

jacqui commented 3 years ago

Yep, this was my own introduced error, because I stringified the metadata before storing it (part of my otherwise working bug fixes for the script). I've taken out the stringify call now and this error has gone away.