Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gatsby-transformer-documentationjs creates non-unique ids #13052

Closed
stefanprobst opened this issue Apr 2, 2019 · 2 comments · Fixed by #13058
Closed

gatsby-transformer-documentationjs creates non-unique ids #13052

stefanprobst opened this issue Apr 2, 2019 · 2 comments · Fixed by #13058
Assignees

Comments

@stefanprobst
Copy link
Contributor

gatsby-transformer-documentationjs creates nodes that can have non-unique ids, for example for comments like these:

/**
 * This is a free-floating comment
 */

/**
 * This is a function
 */
const fn = () => {}

When trying to build such a site with GATSBY_DB_NODES=loki this will throw:

error Error processing Markdown in node 27c286f3-9f32-5454-9d77-a9265e600a7d:
Trying to update unsynced document. Please save the document first by using insert() or addMany()

See repo: https://github.com/stefanprobst/gatsby-bug-docjs

@pieh
Copy link
Contributor

pieh commented Apr 3, 2019

Some context on why this happened:
documentation creates 2 objects for the same path (fn function):
Screenshot 2019-04-03 at 01 38 27

I'm not sure if this is something that actually should be handled in documentation package, but I did open PR (#13058) with fix/workaround for this.

Other thought I have about this is that, while it's nice that loki helped to catch this issue in documentatino plugin - it essentially mean you can't really update plugin with loki? Because this is what was happening with documentation - it created a node, and then tried to create another node with same id and loki just throw - but it should work (even if outcome in this scenario is not desired).

@stefanprobst
Copy link
Contributor Author

Yes i agree that Loki's node updating should check for node.$loki and if it's not there get the node-to-update from the store instead of throw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants