Skip to content

ApiItem not rendering #923

Closed
Closed
@Gijsdeman

Description

@Gijsdeman

Describe the bug

ApiItem not rendering; build does not succeed and not rendering when running locally.

Expected behavior

Completion of build without errors, ability to visit generated pages without errors.

Current behavior

During build; I get the following error (one for each of the generated pages):

Error: Can't render static file for pathname "---"
            at generateStaticFile (/---/documentation/node_modules/@docusaurus/core/lib/ssg.js:119:15)
            at runNextTicks (node:internal/process/task_queues:60:5)
            at process.processImmediate (node:internal/timers:447:9)
            at async /home/gijs/Documents/Eventix/misc/documentation/node_modules/p-map/index.js:57:22 {
          [cause]: Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
              at Xc (server.bundle.js:564037:77)
              at Z (server.bundle.js:564038:89)
              at Xc (server.bundle.js:564032:481)
              at Z (server.bundle.js:564038:89)
              at Xc (server.bundle.js:564036:231)
              at Z (server.bundle.js:564038:89)
              at Xc (server.bundle.js:564032:481)
              at Z (server.bundle.js:564038:89)
              at Vc (server.bundle.js:564030:473)
              at Xc (server.bundle.js:564032:210)
        },

Additional information is provided when running locally:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `ApiItem`.

It seems that there is an issue with the ApiItem, possibly when using in a specific setup (see "Steps to reproduce")

Steps to reproduce

Using the configuration as described in the README, with the only notable difference being that I use a multi-doc instance:

        plugins: [
            [
                '@docusaurus/plugin-content-docs',
                {
                    id: 'api',
                    path: 'api',
                    routeBasePath: 'api',
                    sidebarPath: './sidebarsapi.ts',
                    docItemComponent: '@theme/ApiItem',
                    breadcrumbs: false,
                } satisfies Plugin.Options,
            ],
            ...
        ]

Context

When upgrading I ran into this issue; since all my dependencies seem to match with the demo project, and my configuration is analogous to the one of the README, I think this might be a bug that has not been caught with the quick release of version 4.0.0.

Your Environment

  • Docusaurus 3.5.2
  • Docusaurus-openapi-docs 4.0.0
  • Node 18.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions