@reffuse/extension-query 0.1.5 #16
@@ -11,11 +11,7 @@ export const Route = createFileRoute("/tests")({
|
|||||||
|
|
||||||
function RouteComponent() {
|
function RouteComponent() {
|
||||||
const deepRef = R.useRef({ value: "poulet" })
|
const deepRef = R.useRef({ value: "poulet" })
|
||||||
const deepValueRef = R.useSubRefFromGetSet(
|
const deepValueRef = R.useSubRefFromPath(deepRef, ["value"])
|
||||||
deepRef,
|
|
||||||
b => b.value,
|
|
||||||
(b, a) => ({ ...b, value: a }),
|
|
||||||
)
|
|
||||||
|
|
||||||
// const value = R.useMemoScoped(Effect.addFinalizer(() => Console.log("cleanup")).pipe(
|
// const value = R.useMemoScoped(Effect.addFinalizer(() => Console.log("cleanup")).pipe(
|
||||||
// Effect.andThen(makeUuid4),
|
// Effect.andThen(makeUuid4),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { type Context, Effect, ExecutionStrategy, Exit, type Fiber, type Layer,
|
|||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import * as ReffuseContext from "./ReffuseContext.js"
|
import * as ReffuseContext from "./ReffuseContext.js"
|
||||||
import * as ReffuseRuntime from "./ReffuseRuntime.js"
|
import * as ReffuseRuntime from "./ReffuseRuntime.js"
|
||||||
import { SetStateAction, SubscriptionSubRef } from "./types/index.js"
|
import { PropertyPath, SetStateAction, SubscriptionSubRef } from "./types/index.js"
|
||||||
|
|
||||||
|
|
||||||
export interface RenderOptions {
|
export interface RenderOptions {
|
||||||
@@ -396,6 +396,17 @@ export abstract class ReffuseNamespace<R> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useSubRefFromPath<B, const P extends PropertyPath.Paths<B>, R>(
|
||||||
|
this: ReffuseNamespace<R>,
|
||||||
|
parent: SubscriptionRef.SubscriptionRef<B>,
|
||||||
|
path: P,
|
||||||
|
): SubscriptionSubRef.SubscriptionSubRef<PropertyPath.ValueFromPath<B, P>, B> {
|
||||||
|
return React.useMemo(
|
||||||
|
() => SubscriptionSubRef.makeFromPath(parent, path),
|
||||||
|
[parent],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
useSubscribeRefs<
|
useSubscribeRefs<
|
||||||
const Refs extends readonly SubscriptionRef.SubscriptionRef<any>[],
|
const Refs extends readonly SubscriptionRef.SubscriptionRef<any>[],
|
||||||
R,
|
R,
|
||||||
|
|||||||
Reference in New Issue
Block a user