Emit immediately by default
See original GitHub issueI don’t agree with the current false
default value for emitImmediately
. I would argue most idiomatic reactive code using FlowBinding will want the initial value. In addition, RxBinding emits the initial value by default, and FlowBinding clearly advertises itself as its direct counterpart.
Obviously this is a behavior breaking change, but an important one to get right early.
Issue Analytics
- State:
- Created 3 years ago
- Comments:25 (12 by maintainers)
Top Results From Across the Web
RXJS emit immediately and retry - Stack Overflow
We would like to emit the incomplete data from the first http response and continue making http requests until processed is true.
Read more >defaultIfEmpty - Learn RxJS
Emit given value if nothing is emitted before completion. ... Example 1: Default for empty value ... Example 2: Default for Observable.empty.
Read more >A Guide to Vue $emit - How to Emit Custom Events in Vue
Using emit , we can trigger events and pass data up the component ... <script> export default { methods: { handleChange (event) {...
Read more >interval - RxJS
The first emission is not sent immediately, but only after the first period has passed. By default, this operator uses the async SchedulerLike...
Read more >First operator - ReactiveX
The latest operator is similar, but rather than blocking to wait for the next emitted item, it immediately returns the most-recently-emitted item, and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
What about making
emitImmediately = true
the default and remove that parameter and distinguish between an initial-value flow withInitialValueFlow
and a non initial-value flow withFlow
as usual.Implementation of
InitialValueFlow
could look like thisor as an inline class
I still think representing that different behaviour through the type system is better than having a boolean parameter.
Having the flow emit immediately by default feels more natural to me too.
Thinking on it a bit, I agree that @svenjacobs’s approach is probably the best bet. I always appreciated the explicit
skipInitialValue()
in RxBinding, and providing this behaviour through a type rather than a parameter reads a little nicer.Thumbs up from me 👍