com.raquo.airstream.split
Type members
Classlikes
.split() operator does not tolerate duplicate keys,
i.e. the Seq you provide it must not contain records
that have the same key(record)
.
.split() operator does not tolerate duplicate keys,
i.e. the Seq you provide it must not contain records
that have the same key(record)
.
However, checking for duplicate keys can get expensive when splitting very large lists, so this setting can be used to disable the checks.
When warnings are enabled, YOUR CODE WILL STILL BREAK if the .split() operator encounters duplicate keys, but it will first print a warning in the browser console listing the duplicate keys at fault.
We enable this setting by default to aid in debugging. As the end user, you might want to disable this either globally or for specific .split() usages to improve performance on very large lists.
#TODO[Docs]: Add a short section to the docs about this.
#TODO: Add more granular control later, if there is demand for that. For example, we could instruct Airstream to skip duplicate keys, or to raise an exception if a duplicate happens. In the latter case perhaps we could do that by catching the right exception, without the overhead of checking for duplicates. But not sure how bulletproof that logic would be.
- Companion:
- object
If changing the order, check it first on all Scala versions (and be disappointed). Some of the errors caused by implicit ambiguity are not very deterministic in Scala 3. Be conservative.
If changing the order, check it first on all Scala versions (and be disappointed). Some of the errors caused by implicit ambiguity are not very deterministic in Scala 3. Be conservative.
Broadly similar to parent.map(_.map(project))
, but the project
part
gets access to more data and is memoized by key.
Broadly similar to parent.map(_.map(project))
, but the project
part
gets access to more data and is memoized by key.
See docs.
- Value parameters:
- distinctCompose
Transformation to apply to each key's input stream before providing it to
project
- Usually you want_.distinct
here, so that each of the streams is only triggered when the input for its key actually changes (otherwise they would get an update every time that the parent stream emitted)- key
A sort of grouping / memoization key for inputs in
parent
- project
(key, initialInput, inputChangesForThisKey) => output - Will only be called ONCE for a given key as long as parent contains an Input for this Key - Updates to Input with this Key will be published in
inputChangesForThisKey
- After parent stops containing an Input for this Key, we forget we ever called project for this key
The split
operator needs an implicit instance of Splittable[M] in order to work on observables of M[_]
The split
operator needs an implicit instance of Splittable[M] in order to work on observables of M[_]
- Companion:
- object