Add a bufferUntil
operator
#6055
Sawtaytoes
started this conversation in
Ideas / Feature request
Replies: 1 comment 2 replies
-
@Sawtaytoes Does something like this help? It would need some kind of max thought because it can not buffer values forever or the inner items array would become huge. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Just this week, I had 3 completely different RxJS projects need a
bufferUntil
operator. Two of those projects are waiting on auth tokens and need to buffer actions until it's available. The other one needs to wait on some files to be cached before allowing code to run against those files.bufferUntil
would buffer requests until a notifier emits, then no longer buffers after that.Since I've never written code in the RxJS library, here's my userland interpretation of how I'd build this operator:
If I had to rewrite this to match other buffer methods, it'd look like this:
Many people use Redux-Observable, and waiting for an
authToken
or valid cookie before making API requests is a common pattern. I can't imagine I'm the only person who's ever run into this use case.Questions
mergeAll
or is it possible we'd want this to be customizable so someone could useswitchAll
orexhaustAll
? I can't think why you'd want those, but there's no way tofirst()
orlast()
since you wouldn't have access to the segment.bufferUntil
, you might expect to get an array back like the otherbufferX
methods. Doesn't it make more sense to get a stream of values like my first code example rather than an array?Beta Was this translation helpful? Give feedback.
All reactions