Skip to content

Commit

Permalink
Merge pull request #40 from figma/jake/hide-invisible-children
Browse files Browse the repository at this point in the history
filters out invisible children
  • Loading branch information
jake-figma authored Feb 23, 2024
2 parents 487d5ed + f354c9a commit a1a22aa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion code.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
codegenResultTemplates.push(...matchingTemplates(defaultTemplates));
}
}
const children = "children" in node ? node.children : [];
const children = "children" in node ? node.children.filter((n) => n.visible) : [];
const nodeSnippetTemplateData = await hydrateSnippets(
codegenResultTemplates,
codeSnippetParamsMap,
Expand Down
3 changes: 2 additions & 1 deletion src/snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export async function nodeSnippetTemplateDataArrayFromNode(
codegenResultTemplates.push(...matchingTemplates(defaultTemplates));
}
}
const children = "children" in node ? node.children : [];
const children =
"children" in node ? node.children.filter((n) => n.visible) : [];
const nodeSnippetTemplateData = await hydrateSnippets(
codegenResultTemplates,
codeSnippetParamsMap,
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
codegenResultTemplates.push(...matchingTemplates(defaultTemplates));
}
}
const children = "children" in node ? node.children : [];
const children = "children" in node ? node.children.filter((n) => n.visible) : [];
const nodeSnippetTemplateData = await hydrateSnippets(
codegenResultTemplates,
codeSnippetParamsMap,
Expand Down

0 comments on commit a1a22aa

Please sign in to comment.