You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This error took me hours to hunt down to this simplified test case 😣
The initial value of the source property appears twice in the derived stream:
varsource=Bacon.constant("Y");varunlog=source.log("source");//necessary that original is already subscribedvartimer=setTimeout(function(){varderived=source.doAction(x=>console.log(`doAction:${x}`)).debounce(100);//necessaryderived.log("derived");},20);//any timeout will do// Output:// source – "Y" // source – "<end>"// doAction:Y// doAction:Y <--- DUPLICATE VALUE!// derived – "Y" // derived – "<end>"
Tested in Node.js and the Browser with the new ES6 build.
On closer inspection it is indeed the initial event (Perhaps getting "bounced" too often by PropertyDispatcher.subscribe, as commented in propertydispatcher.ts?)
Unfortunately the quick workaround filtering with .skipDuplicates() is not possible, since it's implemented to let Initial events pass. However with .withStateMachine it's possible to write your own .skipDuplicates.
It's not obvious to me how to fix it: PropertyDispatcher.subscribe, UpdateBarrier and stuff are pretty core Baconjs.
😕
The text was updated successfully, but these errors were encountered:
Is fixed in 3.0.12. The problem was in addPropertyInitValueToStream which had two separate subscriptions to the source Property. It's now called transformPropertyChanges and avoids the double subscription.
This error took me hours to hunt down to this simplified test case 😣
The initial value of the
source
property appears twice in the derived stream:Tested in Node.js and the Browser with the new ES6 build.
On closer inspection it is indeed the initial event (Perhaps getting "bounced" too often by
PropertyDispatcher.subscribe
, as commented inpropertydispatcher.ts
?)Unfortunately the quick workaround filtering with
.skipDuplicates()
is not possible, since it's implemented to letInitial
events pass. However with.withStateMachine
it's possible to write your own.skipDuplicates
.It's not obvious to me how to fix it:
PropertyDispatcher.subscribe
,UpdateBarrier
and stuff are pretty coreBaconjs
.😕
The text was updated successfully, but these errors were encountered: