Skip to content

Dumping navigation data throws TypeError: Converting circular structure to JSON #63

Open
@ReduxFlakes

Description

@ReduxFlakes

I was working on adding complex navigation and breadcrumbs to my site, however I got to a point where I wanted to access the page data trough the navigation as well, since it would be nice to show the description of the pages on the navbar.
I saw that eleventy-navigation-v1.0.0 had implemented support for this and so I updated it, unfortunately there's seems to be a bug where if I try to dump the data on this version (or any newer version past v1.0.0) using:

{% set navigation = collections.all | eleventyNavigation %}
{{ navigation | dump | safe }}

Eleventy throws a TypeError:

[11ty]   TypeError: Converting circular structure to JSON
[11ty]     --> starting at object with constructor 'GlobalDependencyMap'
[11ty]     |     property 'config' -> object with constructor 'Object'
[11ty]     --- property 'uses' closes the circle (via Template render error)

and ends up crashing the web server.

Now I think what's happening here is that, when it goes to cycle trough the page data it also goes trough the eleventyNavigation object, even though we already have it in the object, however I think that is fixed with this commit? I'm not sure, I'm not that experienced in JS so it would be nice to have more eyes on this, other than that I am able to get the page data correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions