Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 17:59
    ntilwalli opened #332
  • 17:30
    ntilwalli closed #331
  • 17:29
    ntilwalli opened #331
  • 14:47
    dependabot[bot] labeled #330
  • 14:47
    dependabot[bot] opened #330
  • 14:47

    dependabot[bot] on npm_and_yarn

    chore(deps): bump cached-path-r… (compare)

  • Jan 24 10:19

    dependabot[bot] on npm_and_yarn

    (compare)

  • Jan 24 10:19

    staltz on master

    chore(deps): bump path-parse fr… (compare)

  • Jan 24 10:19
    staltz closed #323
  • Jan 24 10:19

    dependabot[bot] on npm_and_yarn

    (compare)

  • Jan 24 10:19

    staltz on master

    chore(deps): bump trim-off-newl… (compare)

  • Jan 24 10:19
    staltz closed #329
  • Jan 24 10:15
    dependabot[bot] edited #323
  • Jan 24 10:15
    dependabot[bot] synchronize #323
  • Jan 24 10:15
    dependabot[bot] edited #323
  • Jan 24 10:15

    dependabot[bot] on npm_and_yarn

    chore(deps): bump path-parse fr… (compare)

  • Jan 24 10:15
    dependabot[bot] edited #323
  • Jan 24 10:14
    dependabot[bot] labeled #329
  • Jan 24 10:14
    dependabot[bot] opened #329
  • Jan 24 10:14

    dependabot[bot] on npm_and_yarn

    chore(deps): bump trim-off-newl… (compare)

Alex
@whitecolor
@staltz is it correct that operators convert MemoryStream to Stream?
André Staltz
@staltz
@whitecolor some of them do, like filter, because filter "removes" events and unless we buffer all events from the past, we cant guarantee that the output stream after filter would remain as a memorystream
Alex
@whitecolor
I think this should be stated in docs
Michal Vanko
@michalvankodev
Hello, I'm reading documentation for flattenSequentially

I think the Marble diagram is bit misleading.

* In essence, `flattenSequentially` concatenates all nested streams.
 *
 * Marble diagram:
 *
 * ```text
 * --+--------+-------------------------
 *   \        \
 *    \       ----1----2---3--|
 *    --a--b----c----d--|
 *          flattenSequentially
 * -----a--b----c----d------1----2---3--
 *

```

Shouldn't it be
 * --+--------+-------------------------
 *   \        \
 *    \       ----1----2---3--|
 *    --a--b----c----d--|
 *          flattenSequentially
 * -----a--b----c----d--1-2-3-----
Basically the events which were buffered shouldn't they be emmited right away?
Alex
@whitecolor
why? just after first streams completes it will subscribe to the second and emit the values
Michal Vanko
@michalvankodev
But those buffered events shouldn't be postponed by the time it took them to be emmited in the original stream
Alex
@whitecolor
it will not buffer, it will just subscribe, the example assumes that second stream has no subscribers yet
if it is started you would probably seen only 3 and if its memory stream 2 and 3
I believe it is so in theory) check it in pracice
Michal Vanko
@michalvankodev
Yea.. There is no documentation about subscribing to that second stream.
Alex
@whitecolor
Well the thing is that flattenConcurrenlty will subscribe to second stream as soon as arrives, and flattenSequentially only after previous stream completes
Michal Vanko
@michalvankodev
I get this.. I'm just concerned about the time which it takes to emit the values.
Alex
@whitecolor
say first stream is periodic(1000).take(4) and second periodic(5000).take(3) first start and emits abc, second arrives but will not be subscribed (no emittion) after 4 second, it will be subscribed and will emit 3 values in 15 seconds
you should consider hot/cold/multicasted and meta streams conceptions
it is simple
Michal Vanko
@michalvankodev
I'm going to try this out ;)
Alex
@whitecolor
on this diagram secons + is a moment of arrival of second stream to metastream, not the time of subscribtion
Michal Vanko
@michalvankodev
It dropped all of the values emitted before.. there is no buffer for those
Alex
@whitecolor
if your second stream had subscribers before
Michal Vanko
@michalvankodev
yes ;)
André Staltz
@staltz
Yes this is a tricky thing, and also occurs with concatMap in RxJS, it depends whether the thing being concatted is hot or cold
the intuition is not exactly "concatenation of values", it's more about "sequential subscription to different streams"
that's why I like "flattenSequentially" as a name
Michal Vanko
@michalvankodev
Wise choice :) .. Yesterday I got a question from my colleague if something like what I asked for is possible.. to deal with the events in order would be possible via some operator.. I can only think of flattenConcurrently with some extra logic to delay events from streams that are emitted before the first one finishes
André Staltz
@staltz
probably requires some buffering, we haven't yet made buffer or toArray in xstream, but I think it's on the to-do list
Michal Vanko
@michalvankodev
Didn't something with mapTo() changed in xtream@11? I was generating new IDs with mapTo and the function I've mapped to was always called before I've updated dependencies the last time. Now that function is only called once
Nick Johnstone
@Widdershin
@michalvankodev can you share a code sample?
is it stream$.mapTo(generateId())?
Michal Vanko
@michalvankodev
yes exactly
I get it that it shouldn't work.. .But it worked before
Nick Johnstone
@Widdershin
 λ cat > test.js
const xs = require('xstream').default;

xs.of(1, 2, 3).mapTo(Math.random()).addListener({next: console.log})

 λ npx -p xstream@10 node test.js
npx: installed 2 in 2.063s
0.5104117713843652
0.5104117713843652
0.5104117713843652

 λ npx -p xstream@11 node test.js 
npx: installed 2 in 2.463s
0.07187050076072277
0.07187050076072277
0.07187050076072277
From what I understand, it wouldn't be possible for xstream to change this behaviour
Michal Vanko
@michalvankodev
Thanks.. this is interesting
Michal Vanko
@michalvankodev
Yea I am thinking that the cause might be onionify .. As it might always build the component over and over again when state changed
Nick Johnstone
@Widdershin
can just use map(generateId) in any case
it will do what you actually want
Michal Vanko
@michalvankodev
yes i Know :) ... I've changed it to that way.. I'm just curious why the behavior changed after update
Michal Vanko
@michalvankodev
just to be exact it was
stream$.mapTo(createSomething(generateId()))
André Staltz
@staltz
@michalvankodev I don't think anything changed with stream, map nor mapTo between xstream v10.9 and v11.0
maybe you were using xstream v10.x where x < 9 ?
Michal Vanko
@michalvankodev
I might.. haven't done rm node_modules so I guess npm could keep the older version
Victor Borja
@vic
Hello, is there an easy way to convert an Rxv5 stream into an xstream ? Should I use xs.fromObservable or perhaps rxv5$.subscribe(...) ?
Victor Borja
@vic
looks like xs.fromObservable(rxv5) worked
Michal Vanko
@michalvankodev
@vic Yes xs.fromObservable works.. even with higher order observables ;)
Guys I have a question. I want to do a reactive programming workshop in our company. I don't have much experience with RxJS. But I want that workshop to be useful for people. I think that teaching xstream is far more easier than RxJS as well. Should I focus only on xstream or do you think that xstream is not that useful outside of cycle js
André Staltz
@staltz
Hi @michalvankodev, good news! I think you should teach RxJS or most.js, because of the simpler internals
xstream is complicated, internally