Skip to content

Commit

Permalink
Merge pull request #18 from fergul/main
Browse files Browse the repository at this point in the history
fix: Traverse branches of if/await blocks in preprocessor
  • Loading branch information
bfanger authored Dec 2, 2022
2 parents aab3977 + e904f31 commit e293e10
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib/preprocessReact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,21 @@ function replaceReactTags(
}
}
}
// traverse children
node.children?.forEach((child) => {
replaceReactTags(child, content, components);
});
// traverse else branch of IfBlock
node.else?.children?.forEach((child) => {
replaceReactTags(child, content, components);
});
// traverse then branch of AwaitBlock
node.then?.children?.forEach((child) => {
replaceReactTags(child, content, components);
});
// traverse catch branch of AwaitBlock
node.catch?.children?.forEach((child) => {
replaceReactTags(child, content, components);
});
return components;
}

0 comments on commit e293e10

Please sign in to comment.