Skip to content

Commit

Permalink
feat(): update snippet processor
Browse files Browse the repository at this point in the history
  • Loading branch information
kehua committed Oct 28, 2022
1 parent c415244 commit 407a455
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function getSnippetsOfBrickMap(
const brickMap = new Map();

snippetList?.forEach((item) => {
const hasThumbnail = item.thumbnail;
if (item.useInBricks) {
item.useInBricks?.forEach((brick) => {
const find = brickMap.get(brick);
Expand All @@ -57,7 +58,9 @@ export function getSnippetsOfBrickMap(
const sceneSnippets = find.get(SnippetType.Scene);

sceneSnippets
? sceneSnippets.push(item)
? hasThumbnail
? sceneSnippets.unshift(item)
: sceneSnippets.push(item)
: find.set(SnippetType.Scene, [item]);
}
});
Expand All @@ -69,7 +72,9 @@ export function getSnippetsOfBrickMap(
} else {
const selfSnippets = find.get(SnippetType.SelfBrick);
selfSnippets
? selfSnippets.push(item)
? hasThumbnail
? selfSnippets.unshift(item)
: selfSnippets.push(item)
: find.set(SnippetType.SelfBrick, [item]);
}
}
Expand Down

0 comments on commit 407a455

Please sign in to comment.