baconjs / bacon.jquery

MIT License
74 stars 23 forks source link

Current value not passed when modifying a lens #9

Closed sethtrain closed 11 years ago

sethtrain commented 11 years ago

When modifying a lens the value passed to the modification function seems to always be undefined. The modification can be successfully made to the original model.

var model = Bacon.$.Model({
  left: "left"        
});

var l = model.lens("left");
l.bind(Bacon.$.textFieldValue($("#left")));

// Doesn't work
l.modify(function(current){
  return current + "-asdas";
});

// Works
model.modify(function(current){
  return {left: current.left + "-asdas"};
});
raimohanska commented 11 years ago

Oh sorry, I kinda missed this. I'll look into it.

raimohanska commented 11 years ago

Can reprod. Investigating.

raimohanska commented 11 years ago

Fixed! Btw, now it requires Bacon.js 0.6 or higher.

sethtrain commented 11 years ago

:thumbsup: awesome! thanks!