Fix
All checks were successful
Lint / lint (push) Successful in 14s
Test build / test-build (pull_request) Successful in 21s

This commit is contained in:
Julien Valverdé
2025-04-14 00:54:06 +02:00
parent 98bd72d1d7
commit 1ca832e69d
4 changed files with 38 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "reffuse",
"version": "0.1.6",
"version": "0.1.7",
"type": "module",
"files": [
"./README.md",

View File

@@ -419,8 +419,11 @@ export abstract class ReffuseNamespace<R> {
this: ReffuseNamespace<R>,
ref: SubscriptionRef.SubscriptionRef<A>,
): [A, React.Dispatch<React.SetStateAction<A>>] {
const initialState = this.useMemo(() => ref, [], { doNotReExecuteOnRuntimeOrContextChange: true })
const [reactStateValue, setReactStateValue] = React.useState(initialState)
const [reactStateValue, setReactStateValue] = React.useState(this.useMemo(
() => ref,
[],
{ doNotReExecuteOnRuntimeOrContextChange: true },
))
this.useFork(() => Stream.runForEach(
Stream.changesWith(ref.changes, (x, y) => x === y),