@reffuse/extension-query 0.1.4 #15
@@ -11,11 +11,7 @@ export const Route = createFileRoute("/tests")({
|
||||
|
||||
function RouteComponent() {
|
||||
const deepRef = R.useRef({ value: "poulet" })
|
||||
const deepValueRef = R.useSubRefFromGetSet(
|
||||
deepRef,
|
||||
b => b.value,
|
||||
(b, a) => ({ ...b, value: a }),
|
||||
)
|
||||
const deepValueRef = R.useSubRefFromPath(deepRef, ["value"])
|
||||
|
||||
// const value = R.useMemoScoped(Effect.addFinalizer(() => Console.log("cleanup")).pipe(
|
||||
// Effect.andThen(makeUuid4),
|
||||
|
||||
@@ -2,7 +2,7 @@ import { type Context, Effect, ExecutionStrategy, Exit, type Fiber, type Layer,
|
||||
import * as React from "react"
|
||||
import * as ReffuseContext from "./ReffuseContext.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 {
|
||||
@@ -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<
|
||||
const Refs extends readonly SubscriptionRef.SubscriptionRef<any>[],
|
||||
R,
|
||||
|
||||
Reference in New Issue
Block a user