-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
This seems like it should work:
subscribe({
source: when(
pointerEvents.up$.rewriteTo({
value$: thresholdCrossed$,
onlyEmitWithUpstream: true,
})
).rewriteTo({
value$: dissolveSpring.destination$.inverted(),
onlyEmitWithUpstream: true,
}),
sink: dissolveSpring.destination$,
});to toggle the destination of a spring when a threshold is crossed. dissolveSpring.destination$ is cyclic, but onlyEmitWithUpstream should break the cycle. Nevertheless, it fails with a stack overflow.
Waiting a frame succeeds:
when(
pointerEvents.up$.rewriteTo({
value$: thresholdCrossed$,
onlyEmitWithUpstream: true,
})
).rewriteTo<number>({
value$: dissolveSpring.destination$.inverted(),
onlyEmitWithUpstream: true,
}).subscribe(
value => requestAnimationFrame(
() => dissolveSpring.destination = value
)
)I'm guessing there's a bug in _reactiveMap.
Metadata
Metadata
Assignees
Labels
No labels