{"action":"created","issue":{"url":"https://api.github.com/repos/cujojs/most/issues/201","repository_url":"https://api.github.com/repos/cujojs/most","labels_url":"https://api.github.com/repos/cujojs/most/issues/201/labels{/name}","comments_url":"https://api.github.com/repos/cujojs/most/issues/201/comments","events_url":"https://api.github.com/repos/cujojs/most/issues/201/events","html_url":"https://github.com/cujojs/most/issues/201","id":137646967,"number":201,"title":"sample + fromPromise depends on order","user":{"login":"maxhoffmann","id":1227441,"avatar_url":"https://avatars.githubusercontent.com/u/1227441?v=3","gravatar_id":"","url":"https://api.github.com/users/maxhoffmann","html_url":"https://github.com/maxhoffmann","followers_url":"https://api.github.com/users/maxhoffmann/followers","following_url":"https://api.github.com/users/maxhoffmann/following{/other_user}","gists_url":"https://api.github.com/users/maxhoffmann/gists{/gist_id}","starred_url":"https://api.github.com/users/maxhoffmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxhoffmann/subscriptions","organizations_url":"https://api.github.com/users/maxhoffmann/orgs","repos_url":"https://api.github.com/users/maxhoffmann/repos","events_url":"https://api.github.com/users/maxhoffmann/events{/privacy}","received_events_url":"https://api.github.com/users/maxhoffmann/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-03-01T18:11:25Z","updated_at":"2016-03-05T03:25:32Z","closed_at":null,"body":"It looks like the order of streams passed to `sample` matters if one or more of them are promises. In the second case `forEach` is never called.\r\n\r\nExample:\r\n\r\n```js\r\n  describe('most.js/sample-test', () => {\r\n    it('works', (done) => {\r\n      const stream = most.just(1);\r\n      const promise = Promise.resolve(2);\r\n      const sample = most.just(3);\r\n\r\n      stream\r\n        .sample((...args) => args, most.fromPromise(promise), sample)\r\n        .forEach(value => assert.ok(value));\r\n    });\r\n\r\n    it('does not work', (done) => {\r\n      const stream = most.just(1);\r\n      const promise = Promise.resolve(2);\r\n      const sample = most.just(3);\r\n\r\n      stream\r\n        .sample((...args) => args, sample, most.fromPromise(promise)) // order has changed here\r\n        .forEach(value => assert.ok(value));\r\n    });\r\n  })\r\n```\r\n\r\nIs this supposed to work like that? I’ve tried it with multiple promises as well. It only works if all promises come first. As soon as one stream comes before one of the promises the stream never emits a value like above."},"comment":{"url":"https://api.github.com/repos/cujojs/most/issues/comments/192560844","html_url":"https://github.com/cujojs/most/issues/201#issuecomment-192560844","issue_url":"https://api.github.com/repos/cujojs/most/issues/201","id":192560844,"user":{"login":"briancavalier","id":90518,"avatar_url":"https://avatars.githubusercontent.com/u/90518?v=3","gravatar_id":"","url":"https://api.github.com/users/briancavalier","html_url":"https://github.com/briancavalier","followers_url":"https://api.github.com/users/briancavalier/followers","following_url":"https://api.github.com/users/briancavalier/following{/other_user}","gists_url":"https://api.github.com/users/briancavalier/gists{/gist_id}","starred_url":"https://api.github.com/users/briancavalier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briancavalier/subscriptions","organizations_url":"https://api.github.com/users/briancavalier/orgs","repos_url":"https://api.github.com/users/briancavalier/repos","events_url":"https://api.github.com/users/briancavalier/events{/privacy}","received_events_url":"https://api.github.com/users/briancavalier/received_events","type":"User","site_admin":false},"created_at":"2016-03-05T03:25:32Z","updated_at":"2016-03-05T03:25:32Z","body":"I managed to write down why the two argument orderings behaved differently, and also why the change in the branch causes them to have the same behavior.  This is really down in the weeds, but I figured it might be interesting.  It also never hurts to record it somewhere for posterity :)\r\n\r\nhttps://gist.github.com/briancavalier/a27ddc247dd118ae5508"}}