Skip to content

Menu & View All list breaks if pattern name and folder name are identical #1049

@coreylafferty

Description

@coreylafferty

I am using Pattern Lab Node v3.0.3 on Windows, with Node v10.15.1, using the Twig Edition.

Expected Behavior

All patterns show on the View All page and are properly nested in their parent item in the navigation.

Actual Behavior

If a filename matches that of the parent folder, the resulting menu shows the item outside the parent folder. The same pattern does NOT show up on the View All page.

Steps to Reproduce
  1. Start up a fresh copy of Pattern Lab Node, using the Twig engine and Twig starter kit.
  2. Look at the Atoms / Buttons pattern in the menu and file system as an example.
  3. Notice that the Buttons item does not show in a Buttons folder (despite the file being 00-atoms/06-buttons/00-buttons.twig) and that Buttons does not show in either the main View All list or the Atoms category View All list.

image

  1. As a clearer test, create the following four files to see how the menu handles similar patterns when the parent folder does and does not match one of them:

Folder name (cats) does NOT match a pattern filename in it since it is plural
/_patterns/01-molecules/cats/cat.twig
/_patterns/01-molecules/cats/cat-special.twig

Folder name (dog) does match a pattern filename in it
/_patterns/01-molecules/dog/dog.twig
/_patterns/01-molecules/dog/dog-special.twig

image

The two 'cat' files behave as expected, properly nested in a 'Cats' folder. The dog items do not, with the 'dog' folder being created without a toggle to open it and 'dog special' not showing at all -- the other pattern shows outside the dog folder but does not show in the View All list (similar to the buttons example above).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions