Skip to content

Commit

Permalink
Fix submenu items having duplicate IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
gyng committed Aug 5, 2018
1 parent da480c8 commit 54901d4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,13 @@ const Menus = {
// 2. Parse comments
// 3. Parse depth
// 4. Construct menu items
pathsArray.forEach(dir => {
pathsArray.forEach((dir, i) => {
// HACK
if (dir === SPECIAL_DIRS.SEPARATOR) {
Menus.makeSeparator(contexts);
} else {
const parsed = Menus.parsePath(dir);

const { comment, depth, meta, validation, parsedDir } = parsed;

if (!validation.valid) {
Expand All @@ -237,7 +238,9 @@ const Menus = {
} else {
menuItemCounter[depth] = 1;
}
const id = `save-in-${menuItemCounter[depth]}-${comment}-${parsedDir}`;
const id = `save-in-${menuItemCounter[
depth
]}-${`${i}${comment}`}-${parsedDir}`;

let parentId;
if (depth === 0) {
Expand Down

0 comments on commit 54901d4

Please sign in to comment.