patternlab-php-core
patternlab-php-core copied to clipboard
Pattern-subtypes without patterns not exported to navItems and viewAllPaths
We currently encounter an issue where clicking on some 'view all'-links causes the 'viewport' iframe to load the pattern lab index page again, leading to a second (non-functional) navigation bar with an empty viewport below (see https://i.imgur.com/9JY9H0r.png).
I traced this issue back to the following conditions:
- Either the pattern-subtype corresponding to the 'view all'-link has no patterns...
- or it has one or more patterns consisting of only a Markdown-description (without a template)
This is caused by a difference in 'inclusion criteria' between the NavItemsExporter
/ViewAllPathsExporter
and Builder::generateViewAllPages
. The latter does generate 'view all'-pages for empty pattern subtypes (and links to them), but the NavItemsExporter
removes empty sections. This also causes them to not be present in the viewAllPaths
on the client, leading to incorrect filenames being returned from urlHandler.getFileName
.
I would be happy to contribute a PR with a fix, but I'm not certain what the correct behavior would be. Should a pattern-subtype without any patterns (with template) be considered a full-fledged pattern-subtype (and thus be shown also in the navigation) or not?