Skip to content

Commit

Permalink
fix: don't break on empty routes
Browse files Browse the repository at this point in the history
  • Loading branch information
patroza committed Jan 29, 2025
1 parent 7fa9a5c commit 28c81ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gold-cars-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect-app/infra": patch
---

fix: don't break on empty routes
6 changes: 5 additions & 1 deletion packages/infra/src/api/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,11 @@ export const makeRouter = <
}
})
)
.pipe(Layer.provide(routers.map((r) => r.routes).flat() as unknown as NonEmptyArray<Layer.Layer.Any>))
.pipe(
routers.length
? Layer.provide(routers.map((r) => r.routes).flat() as unknown as NonEmptyArray<Layer.Layer.Any>)
: (_) => _
)

return {
layer: r as Layer.Layer<
Expand Down

0 comments on commit 28c81ff

Please sign in to comment.