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

broken livebinding after replace can.Map property or remove property #525

Closed
pYr0x opened this issue Nov 2, 2013 · 5 comments · Fixed by #532
Closed

broken livebinding after replace can.Map property or remove property #525

pYr0x opened this issue Nov 2, 2013 · 5 comments · Fixed by #532
Assignees
Milestone

Comments

@pYr0x
Copy link

pYr0x commented Nov 2, 2013

hi,

i have some interesting behaviour that brokes down the livebinding with mustache and can.Map

i have a simple template with deep properties

here is me {{test.firstname}} {{test.lastname}}

if i have that javascript, that livebinding brokes

foobar = new can.Map();

var obj = {
'firstname': 'hans',
'lastname': 'peter'
};

foobar.attr('test',obj);

this will shows the right.. but after a second time and an other object replace the "test" there is no livebinding anymore

var obj = {
'firstname': 'michael',
'lastname': 'grau'
};

foobar.attr('test',obj);

same procedure if i want to remove "test" with deep properties

foobar.removeAttr('test');
@ghost ghost assigned justinbmeyer Nov 2, 2013
@justinbmeyer
Copy link
Contributor

Thanks! I'm going to work on fixing this for 2.0.1. In the short term, if you do:

here is me {{#test}}{{firstname}} {{lastname}}{{/test}}

it will work

@pYr0x
Copy link
Author

pYr0x commented Nov 2, 2013

Any idea when 2.0.1 will be Release?

@justinbmeyer
Copy link
Contributor

justinbmeyer added a commit that referenced this issue Nov 6, 2013
@colinexl
Copy link

colinexl commented Jan 2, 2014

I know this issue has been closed, but after the changes in this commit, our compute no longer works the way it did.

Here's a fiddle: http://jsfiddle.net/qYdwR/1180/

Before, we initialized an empty compute by using

can.compute()

Then after some async operations are done, it'll update the compute by calling

can.compute(new ConstructOfSomeSort())

This would then cause the Mustache view to update itself due to live-binding. However, after this commit, the Mustache doesn't update itself anymore. I dug around briefly and it looks like the "computed" function in compute.js is no longer being called after the can compute update.

I believe this issue is happening in the latest CanJS2 as well.

@justinbmeyer
Copy link
Contributor

If you believe this is a bug, please open a new issue and reference this commit.

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

Successfully merging a pull request may close this issue.

3 participants