Docz: Duplicated menu when using hierarchy

Created on 21 Mar 2019  路  18Comments  路  Source: doczjs/docz

Bug Report

When adding sub-menu items, I'm facing an item both inside it's parent and in the root level:

joxi_screenshot_1553196055980

Here is the document configuration:

---
name: Composition
route: /concepts/composition
menu: Concepts
---

And here is the menus config:

// doczrc.js
module.exports = {
  menu: [
    'Introduction',
    'Getting Started',
    { name: 'Development', menu: ['Structure', 'Environment & Commands'] },
    { name: 'Concepts', menu: ['Composition'] },
    { name: 'Reference', menu: ['Routing', 'Layouts & Blocks', 'Menus'] }
  ]
}

Expected behavior

Once I configure an item to be shown under a parent, it should not be shown in the root level.

bug stale v2

Most helpful comment

Is there an example of a working implementation of docz v1.2.0 with a custom menu using the above structure? I am getting duplicate entries and the one in the sub-menu is not clickable and does not function, yet the auto-generated duplicate appears to work.

All 18 comments

@lucasconstantino try to update to the new release, this can be fixed on it 馃檹

@pedronauck I'm currently having the same issue on 1.2.0. So I think this is not yet fixed unfortunately.

Is there an example of a working implementation of docz v1.2.0 with a custom menu using the above structure? I am getting duplicate entries and the one in the sub-menu is not clickable and does not function, yet the auto-generated duplicate appears to work.

This regression exists in v2 as well.

I believe the issue exists here: https://github.com/doczjs/docz/blob/cfe07b0c00fa5ff73bd194fbc48240a5315bc10e/core/docz/src/hooks/useMenus.ts#L141

cc @rakannimer

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

/notstale

Any updates on this? Makes using the menu option basically infeasible.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

/notstale part2

Still not stale, running into this now.

In case it helps anyone else, I'm currently working around this by explicitly hiding the undesired links via CSS:

// Hack to hide duplicate nested menu items https://github.com/doczjs/docz/issues/694
div[data-testid="sidebar"] > a[href*="/entities/"] {
  display: none;
}

Hello @jakemmarsh @mAAdhaTTah !
Do you guys still run into this issue ? I tried to replicate your issue but I can't seem to reproduce it
If you do, can you guys give me your project's version of docz + gatsby-theme-docz ?
(Upgrading it might solve the issue)

@mickaelzhang this issue does still exist for me on the latest versions: [email protected] and [email protected]

Running into the same issue on version [email protected].

Can you guys direct me to a project where you have this issue?

I ended up rewriting the menu setup to avoid it so I don't have a case right now. I'll see if I can reproduce it.

This appears to be fixed in master. Tried to reproduce in the basic example:

image

doczrc.js

export default {
  menu: [
    'Getting Started',
    'Readme',
    { name: 'Components', menu: ['Alert2', 'Alert'] },
  ],
}

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings