Fix Component.provide
Lint / lint (push) Failing after 19s

This commit is contained in:
Julien Valverdé
2026-08-21 01:49:38 +02:00
parent 1dd2e395ce
commit 07a79f9b83
+4 -13
View File
@@ -636,15 +636,6 @@ export declare namespace provide {
* Component.provide(TodosService.Default),
* )
* ```
*
* @example Providing a layer with dependencies
* ```tsx
* const UserViewLive = Component.provide(
* UserView,
* UserService.layer,
* )
* // UserViewLive still requires UserRepository, which UserService.layer needs.
* ```
*/
export const provide: {
<ROut, E, RIn>(
@@ -659,10 +650,10 @@ export const provide: {
layer: Layer.Layer<ROut, E, RIn>,
): provide.Result<T, ROut, E, RIn> => Object.setPrototypeOf(
Object.assign(function() {}, self, {
body: Effect.fnUntraced(function*(props: Component.Props<T>) {
const context = yield* useLayer(layer)
return React.createElement(yield* Effect.provide(self.use, context), props)
}),
body: (props: Component.Props<T>) => Effect.flatMap(
useLayer(layer),
context => Effect.provide(self.body(props), context),
),
}),
Object.getPrototypeOf(self),
))