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.

Error in node creation for @reflexjs/gatsby-theme-doc

See original GitHub issue

Maybe I’m just being impatient to try out an unreleased (?) Gatsby theme, but I get the following error when adding @reflexjs/gatsby-theme-doc to the base starter and adding an example MDX file in content/docs/.

error "@reflexjs/gatsby-theme-doc" threw an error while running the onCreateNode lifecycle:

object null is not iterable (cannot read property Symbol(Symbol.iterator))

  56 |   if (docNode) {
  57 |     const parent = getNode(node.parent)
> 58 |     const [, weight, name] = parent.name.match(/^(\d+)-(.*)/)
     |                              ^
  59 |     actions.createNode({
  60 |       ...docNode,
  61 |       weight: parseInt(weight),


  TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))

  - gatsby-node.js:58 Object.exports.onCreateNode
    [eadocs-reflex]/[@reflexjs]/gatsby-theme-doc/gatsby-node.js:58:30

Also, I don’t see any examples or references to this theme in the docs (as the README.md for the package suggests). If this is still an upcoming feature, that makes perfect sense—and I can’t wait to try it when it’s ready!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
shadcncommented, Nov 27, 2020

OK I looked into it a bit and created an example here:

Demo: https://reflexjs-product-docs.netlify.app Repo: https://github.com/arshad/reflexjs-product-docs

How it works

Reflexjs has support for additional fields that are passed down from frontmatter to the schema.

  1. I created one nav for each doc. See https://github.com/arshad/reflexjs-product-docs/tree/master/content/navs
  2. I’m then using additional fields to set the nav name for each product doc.
---
title: Product One
excerpt: This is doc for product one.
nav: doc-product-one
---
  1. I updated doc.js and doc-nav.js to accept this nav as prop.
// doc-nav.js
export const DocNav = ({ name, onClick, ...props }) => {
  const [nav] = useNav(name)
}

https://github.com/arshad/reflexjs-product-docs/blob/master/src/%40reflexjs/gatsby-theme-doc/doc-nav.js#L112

// doc.js
<DocNav name={data.nav} onClick={() => setShowMenu(false)} />

https://github.com/arshad/reflexjs-product-docs/blob/e6560305f337f455ce36f3c66b5bb4c0b498cd8d/src/%40reflexjs/gatsby-theme-doc/doc.js#L76

0reactions
shadcncommented, Nov 27, 2020

Yeah. I can take a look at it.

The other themes support subfolders so I think it should be easy to add.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot EKS managed node group failures - AWS
My Amazon Elastic Kubernetes Service (Amazon EKS) managed node group failed to create. Nodes can't join the cluster and I received an error...
Read more >
21 minutes. error waiting for EKS Node Group to create ...
My node groups will create but fail. The autoscaling instances will spin up hosts but they won't attach to the cluster. vpc-cni fails...
Read more >
Node.js — Create Your Own Custom Error - Future Studio
Errors in Node.js are extensible classes. This tutorial walks you through the creation of your own error class.
Read more >
Errors | Node.js v19.3.0 Documentation
SyntaxError instances are unrecoverable in the context that created them – they may only be caught by other contexts. Class: SystemError #. Extends:...
Read more >
Node.js Error Handling Best Practices: Ship With Confidence
The built-in error constructor is simply a unified way of creating an error object. What are error objects, anyway? Why do they need...
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