Description
I am using Pattern Lab Node v5.7.1
on Windows
, with Node v10.15.1
.
Expected Behavior
Folder names and file names should not break the menu if they happen to be the same.
Actual Behavior
Prior to 5.7.0, the menu worked as expected when subfolder names and file names matched. Since 5.7.0, menu functionality breaks when this is the case. Clicking on submenu items will display the wrong items or no item at all.
@bmuenzenmeyer @david-moldenhauer I believe this is due to the changes from this PR, specifically these lines:
https://github.com/pattern-lab/patternlab-node/pull/1016/files#diff-811dc08dbb9437f8b472a21f0c9bd66eR38-R40
Steps to Reproduce
Install a fresh copy of PL and create the following files/folders in /source/_patterns/:
02-organisms/broken/broken.twig
02-organisms/broken/broken-item1/broken-item1.twig
02-organisms/broken/broken-item2/broken-item2.twig
Open PL in the browser and click the arrow next to the 'Broken' menu under 'Organisms' then click on the first child (Broken Item2). Note that it will actually show the wrong item and mark the wrong item as active in the menu.
The issue here seems to be that the subfolder name (e.g., broken-item1) and the filename in it (broken-item1.twig) are identical (ignoring the file extension).
To contrast, create the following files/folders in /source/_patterns/ to see an almost identical situation, but where everything works as expected. The only difference here is that the subfolder file name (e.g., working1) does NOT match the filename in it (e.g., working-item1).
02-organisms/working/working.twig
02-organisms/working/working1/working-item1.twig
02-organisms/working/working2/working-item2.twig