Skip to content

Enabling 'type: page' in _meta.global.ts causes a key conflict #4369

@mikemaccana

Description

@mikemaccana

I have a nextra site with a front page (which is more a project overview), and a dedicated /docs page with my docs.

Enabling type: page with a subdir of /docs (so Docs appears in the top navbar when on '/') causes a conflict between the first two items in the side navbar.

To Reproduce

I have the following _meta.global.ts.

// https://nextra.site/docs/file-conventions/meta-file#type-page-option
export default {x
  docs: {
    title: "Docs",

    // This causes a conflict with the sidebar
    // 'Two items have a key of index'
    // when I load /docs
    type: "page",

    items: {
      connecting: "Connecting to a Solana RPC",
      wallets: "Wallets",
      sol: "SOL",
      explorer: "Solana Explorer",
      tokens: "Tokens",
      transactions: "Transactions",
      anchor: "Anchor",
    },
  },
};

Commenting out 'type: page' (so docs appears on the top nav per https://nextra.site/docs/file-conventions/meta-file#) will cause:

Encountered two children with the same key, index

Using React devtools, these are the two components with the same key of index. These are the links to / and /docs respectively.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions