question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistency with stream manipulation inside a stream

See original GitHub issue

There seems to be inconsistency between flyd.map operations inside a stream body or I’m not using it correctly. Could you verify this?

// helper function
const log = message => val => {
  console.log(message, val);
  return val;
};

const stream$ = flyd.stream(true);

flyd.stream(1).map(() => {
  stream$
    .map(log('this prints and returns true...'))
    .map(log('...but it never reaches here'));
});

It works correctly if stream$ is created inline inside the flyd.map(), but if it’s created outside: it’ll only reach the first map, but not the second one.

Edit: flyd version is 0.2.6

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
paldepindcommented, Jun 20, 2018

Props to @shpuld for fixing this issue 🎉. The atomic update code in Flyd is indeed a bit tricky. Unfortunately, I 've had a lot of my plate in the last couple of months with my bachelor’s thesis and finals. But, I’m very happy to see the conversation in this thread and that the issue was solved. Thank’s a lot everyone!

2reactions
niantcommented, Jun 7, 2018

@nordfjord Thank you for providing some insight into the codebase 👍 We got one solution working like @shpuld mentioned: do you think it could work or is it even close? (It relies on a new global variable though, if that’s a problem or not…) We can do a pull request with the fix and discuss implementation as well (@paldepind ?)

Also thanks @m59peacemaker , all the help is appreciated! Wark looks interesting, and there could be some clues how to handle this problem in flyd as well. Separating atomic updates sounds like a good idea to me, at least eventually.

Flyd has been good to us and I do like the API simplicity and fantasy-land support it has among other things. I’ll try to help best I can solving this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Problems with Using the reduce() Terminal ...
... with using the Java stream reduce() terminal operation, ... with Using the reduce() Terminal Operations in Java Parallel Streams.
Read more >
Java Stream Generics Type Mismatch - Stack Overflow
This is because of type inference: The type is "guessed" from it's target: we know that map(anything) must return a "Stream<Class<? extends ...
Read more >
Working With Maps Using Streams | Baeldung
In this tutorial, we'll discuss some examples of how to use Java Streams to work with Maps. It's worth noting that some of...
Read more >
Java 8 Stream - DigitalOcean
Java Stream operations use functional interfaces, that makes it a very good fit for functional programming using lambda expression. As you can ...
Read more >
Difference Between Streams and Collections in Java
A stream is not a data structure instead it takes input from the Collections, Arrays, or I/O channels. Streams don't change the original...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found