You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was exploring stream restoration with catchError and I just wanted to notify the stream that it was broken and restored. Here's what I came up with:
server$.pipe(catchError((_,stream)=>stream.pipe(map((value,index)=>index ? value : 'Connection restored\n'+value),startWith('Connection lost'))),scan((acc,value)=>acc+'\n'+value))
While on the surface it looks right, if I put console.log in there, it starts to show something like a recursion going deeper each cycle. Here's the StackBlitz: https://stackblitz.com/edit/rxjs-wbuhya
This got me worried about memory and such so I thought I'd bring it up here for a little discussion. Is this expected behavior? Is it ok? Should I do what I do differently?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I was exploring stream restoration with
catchError
and I just wanted to notify the stream that it was broken and restored. Here's what I came up with:While on the surface it looks right, if I put
console.log
in there, it starts to show something like a recursion going deeper each cycle. Here's the StackBlitz:https://stackblitz.com/edit/rxjs-wbuhya
This got me worried about memory and such so I thought I'd bring it up here for a little discussion. Is this expected behavior? Is it ok? Should I do what I do differently?
Beta Was this translation helpful? Give feedback.
All reactions