Skip to content

Commit d0672f6

Browse files
committed
fix(patterns): find all patterns inlcuding pseudo patterns
find all patterns including pseudo patterns and sort them after retrieving all patterns instead of inject them in the array working on fixes issue #975
1 parent a37d708 commit d0672f6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/core/src/lib/addPattern.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,7 @@ module.exports = function(pattern, patternlab) {
4141
patternlab.partials[pattern.patternPartial] = pattern.patternDesc;
4242
}
4343

44-
//patterns sorted by name so the patterntype and patternsubtype is adhered to for menu building
45-
patternlab.patterns.splice(
46-
_.sortedIndexBy(patternlab.patterns, pattern, 'name'),
47-
0,
48-
pattern
49-
);
44+
patternlab.patterns.push(pattern);
5045
patternlab.graph.add(pattern);
5146
}
5247
};

packages/core/src/lib/patternlab.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,12 @@ module.exports = class PatternLab {
334334
this.patterns.map(pattern => {
335335
return processIterative(pattern, self);
336336
})
337-
);
337+
).then(() => {
338+
// patterns sorted by name so the patterntype and patternsubtype is adhered to for menu building
339+
this.patterns.sort((pattern1, pattern2) =>
340+
pattern1.name.localeCompare(pattern2.name)
341+
);
342+
});
338343
});
339344
}
340345

0 commit comments

Comments
 (0)