Skip to content

Commit

Permalink
astro: fixes infinite loop during deployment caused by Astro plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Mar 14, 2024
1 parent 63337eb commit 8d3d380
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 1 addition & 3 deletions examples/astro/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ export default $config({
return {
name: "astro",
removal: input?.stage === "production" ? "retain" : "remove",
providers: {
aws: {},
},
home: "aws",
};
},
async run() {
Expand Down
6 changes: 5 additions & 1 deletion pkg/platform/src/components/aws/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,11 @@ function buildRouteTree(routes: BuildMetaConfig["routes"], level = 0) {
) {
delete routeTree.branches[key];
} else if (branch.nodes.length > 1) {
routeTree.branches[key] = buildRouteTree(branch.nodes, level + 1);
const deduplicatedNodes = branch.nodes.filter(
(node, index, arr) =>
arr.findIndex((n) => n.pattern === node.pattern) === index,
);
routeTree.branches[key] = buildRouteTree(deduplicatedNodes, level + 1);
branch.nodes = [];
}
}
Expand Down

0 comments on commit 8d3d380

Please sign in to comment.