Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atomic updates not working fully with streams inside other streams #179

Closed
shpuld opened this issue Jun 25, 2018 · 4 comments
Closed

Atomic updates not working fully with streams inside other streams #179

shpuld opened this issue Jun 25, 2018 · 4 comments

Comments

@shpuld
Copy link
Contributor

shpuld commented Jun 25, 2018

Creating a new issue out this bug that I found when working on #177

Basically when you have more complicated dependencies that are updated inside other streams, atomic updates break and you get more updates than you would expect.

Issue can be seen in a test case like this:

var result = 0;
stream(1).map(function() {
  stream(0)
    .map(function(val) {
      result += 1;
      return val + 1;
    })
    .map(function(val) {
      result += 1;
      return val + 1;
    });
});
assert.equal(result, 2);

The assert fails with the value of 4 (and before the fix for #177 it would fail with the value of 3).

@nordfjord
Copy link
Collaborator

Ok, I've made a rather large PR (#180) to fix this, It solves both #177 and this issue. Got all the tests running finally, sorry for how long it has taken, I haven't had much free time recently.

@nordfjord
Copy link
Collaborator

Feel free to take a look at it to see if you spot any problems.

@shpuld
Copy link
Contributor Author

shpuld commented Jun 28, 2018

Very cool, thank you for this!

@paldepind
Copy link
Owner

The fix by @nordfjord is now on npm as version 0.2.8 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants