Rename withRuntime to withContext
Lint / lint (push) Successful in 39s

This commit is contained in:
Julien Valverdé
2026-07-19 18:44:01 +02:00
parent f22743eefe
commit 1dc8368750
10 changed files with 23 additions and 23 deletions
+4 -4
View File
@@ -612,12 +612,12 @@ export const withOptions: {
*
* // Route definition
* export const Route = createFileRoute("/")({
* component: Component.withRuntime(HomePage, runtime.context)
* component: Component.withContext(HomePage, runtime.context)
* })
* ```
*
*/
export const withRuntime: {
export const withContext: {
<P extends {}, A extends React.ReactNode, E, R, F extends Component.Signature>(
context: React.Context<Context.Context<R>>,
): (self: Component<P, A, E, Scope.Scope | NoInfer<R>, F>) => F
@@ -628,9 +628,9 @@ export const withRuntime: {
} = Function.dual(2, <P extends {}, A extends React.ReactNode, E, R, F extends Component.Signature>(
self: Component<P, A, E, R, F>,
context: React.Context<Context.Context<R>>,
) => function WithRuntime(props: P) {
) => function WithContext(props: P) {
return React.createElement(
Effect.runSyncWith(React.useContext(context))(self.use) as React.FC<P>,
Effect.runSyncWith(React.useContext(context))(self.use),
props,
)
})