Stream fix
All checks were successful
Lint / lint (push) Successful in 13s

This commit is contained in:
Julien Valverdé
2025-03-21 03:24:55 +01:00
parent aab83907ba
commit 2d94e84941
2 changed files with 8 additions and 6 deletions

View File

@@ -12,9 +12,10 @@ export const LazyRefExtension = ReffuseExtension.make(() => ({
const initialState = this.useMemo(() => ref, [], { doNotReExecuteOnRuntimeOrContextChange: true })
const [reactStateValue, setReactStateValue] = React.useState(initialState)
this.useFork(() => Stream.runForEach(ref.changes, v => Effect.sync(() =>
setReactStateValue(v)
)), [ref])
this.useFork(() => Stream.runForEach(
Stream.changes(ref.changes),
v => Effect.sync(() => setReactStateValue(v)),
), [ref])
const setValue = this.useCallbackSync((setStateAction: React.SetStateAction<A>) =>
LazyRef.update(ref, prevState =>