-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update pattern discovery and fix "view all" issues #1143
Conversation
- Fixed test cases incorrect - Fixed view all pages not generated - Fixed view all page could not be loaded - Fixed pattern ordering - Fixed subfolder patterns have invalid data - Fixed subfolder patterns are not rendered properly
@@ -125,7 +117,7 @@ const Pattern = function(relPath, data, patternlab) { | |||
this.lineageR = []; | |||
this.lineageRIndex = []; | |||
this.isPseudoPattern = false; | |||
this.order = Number.MAX_SAFE_INTEGER; | |||
this.order = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patterns should be sorted after groups and before view all page of that group.
@@ -222,13 +223,19 @@ tap.test('groupPatterns - creates pattern groups correctly', function(test) { | |||
'patternType1-white' | |||
); | |||
|
|||
// Flat patterns | |||
test.equals( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional test for flat patterns
@bmuenzenmeyer I have also added some comments in here 1143/files for lines or blocks where it seems to be necessary. Feel free to add additional comments. After hours and hours of debugging, I hope I could resolve all issues provided here. 💯 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found additional features and issues to resolve
@JosefBredereck excited to look at this closer - but I need a day or so more |
Take your time. This should be checked completely and its not just one line of code I changed. |
@JosefBredereck I gave this a quick test and it does appear to fix #1134. Thank you! I'm not sure if it's an intentional change or not, but I did notice that any categories with nested items now appear at the top of the list before those without children. Just thought I'd draw attention to it in case that's not the intended behavior. |
I will test that again explicit, thanks for the hint. 👍 |
@coreylafferty that's what I get and it looks correct to me. When you add a pattern in the same folder as the pattern name the folder will get removed. The folders are for better structuring in your folder architecture. See #992 - Also if you add something like And when I click on broken item 1 it's also correct. |
@JosefBredereck I just tested it again and I am seeing some odd behavior. Below is a screenshot of our theme with your changes applied. I'd expected to see 'Article' come before 'Button', but instead all of the items with children are grouped at the top of the list followed by single items. That may be the intention so maybe that doesn't need to change... but there is a bigger problem. More troubling is that now 'Button' is both a folder and a single item. I would expect that the single 'Button' item would be in the 'Button' folder with the variants (e.g., Danger Button, Large Button, etc.). The way we organize our files is according to BEM class names, so that's why this is important. For example, here is how Article and Button are structured in our folders:
For reference, here's what our theme looks like using Pattern Lab version 5.4.0 (prior to the change that broke things for us) |
Let me think about that until tomorrow. Maybe I can get a good solution for that. 🤔 Very good case by the way. |
Thank you! Please let me know if I can give you any more details or test anything. |
@bmuenzenmeyer @JosefBredereck Does Josef's answer above point towards next steps and/or are specific changes still requested to this PR? Hoping to see this accepted (when it's ready) as the fixes here will unblock us from upgrading PL in our theme. For what it's worth, I agree with with @bmuenzenmeyer's assessment of the subfolder variable... I prefer that name (subfolder over subbed) and think when it's true (or not set), items should show in a subfolder.
|
From my point of view there was nothing left so far. |
Updated from dev. |
I changed this to a more specific name
|
Hey @JosefBredereck @coreylafferty so sorry for being a bit out of the loop on this -- this good to get merged down and released, yes? |
From my point of view, yes. I also used this branch in a production application already. I hope the docs are enough and grammatically correct. |
@sghoweri @JosefBredereck I won't pretend to understand all the changes here, but in my testing this solves the nesting problem I'd described in #1134 and the nesting behaves as I'd expect. Setting the DeeplyNested value in the MD files does move the pattern in or out of a subfolder, so that's working as described, with the default, undefined condition being how PL has traditionally handled the nesting. I'll admit I don't fully understand what the name 'DeeplyNested' is meant to indicate since at first I expected it to behave the opposite than it does -- with the 'false' condition being the one that flattens the item in the menu structure, placing it outside its own folder (which currently is the True condition)... but since the default/false is to have the menu behave as I'd expect, I don't see the name being a big issue. |
Changes since original PR feedback submitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get this shipped 🚀 -- thanks again for the added docs and ton of new tests added with this. 👍
PR was released with v5.12.0 |
Update pattern discovery and fix "view all" issues
Closes
Replaces
Summary of changes:
Features
link.viewall-group-all
andlink.viewall-group-subgroup
Bugs