From f7534d63f82faf8254c4fa72b269af28770c8992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 21 Jul 2025 01:50:00 +0200 Subject: [PATCH] Work --- packages/effect-fc/src/Component.ts | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/effect-fc/src/Component.ts b/packages/effect-fc/src/Component.ts index 3b484f2..c692bfa 100644 --- a/packages/effect-fc/src/Component.ts +++ b/packages/effect-fc/src/Component.ts @@ -380,29 +380,6 @@ export const suspense = , P extends {}>( ) -export const withRuntime: { - , R>( - context: React.Context>, - ): (self: T) => React.FC & SuspenseProps - : Component.Props - > - ( - self: Component & Suspense, - context: React.Context>, - ): React.FC

- ( - self: Component, - context: React.Context>, - ): React.FC

-} = Function.dual(2, ( - self: Component, - context: React.Context>, -): React.FC

=> function WithRuntime(props) { - const runtime = React.useContext(context) - return React.createElement(Runtime.runSync(runtime)(useFC(self)), props) -}) - export const useFC: { ( self: Component & Suspense @@ -469,3 +446,26 @@ export const use: { } = Effect.fn("use")(function*(self, fn) { return fn(yield* useFC(self)) }) + +export const withRuntime: { + , R>( + context: React.Context>, + ): (self: T) => React.FC & SuspenseProps + : Component.Props + > + ( + self: Component & Suspense, + context: React.Context>, + ): React.FC

+ ( + self: Component, + context: React.Context>, + ): React.FC

+} = Function.dual(2, ( + self: Component, + context: React.Context>, +): React.FC

=> function WithRuntime(props) { + const runtime = React.useContext(context) + return React.createElement(Runtime.runSync(runtime)(useFC(self)), props) +})