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

can.view.render update is sometimes undefined #360

Closed
amcdnl opened this issue Apr 18, 2013 · 5 comments
Closed

can.view.render update is sometimes undefined #360

amcdnl opened this issue Apr 18, 2013 · 5 comments
Assignees
Labels
Milestone

Comments

@amcdnl
Copy link
Contributor

amcdnl commented Apr 18, 2013

The can.view.render class sometimes throws an Uncaught TypeError: undefined is not a function error because the update function is undefined at the call time.

See : https://github.com/bitovi/canjs/blob/master/view/render.js#L227

I propose we add change it to be update && update(newVal, oldVal)

See: http://screencast.com/t/jauYywxJSV

@ccummings
Copy link
Contributor

The binder is called is called right away and if something updates the value before hookups are run, update will be undefined. This typically happens when a value used in live binding is updated inside of a can.view call, which is a bad thing to do.

A nicer fix is to assign a function to update at https://github.com/bitovi/canjs/blob/master/view/render.js#L261 that updates binding.value to newValue and console.warns that the developer might be shooting themselves in the foot.

This should make things work most of the time.

@daffl
Copy link
Contributor

daffl commented Apr 18, 2013

That sounds good. This issue keeps coming (e.g. #218) up so fixing it would be very helpful.

@ghost ghost assigned ccummings Apr 18, 2013
@amcdnl
Copy link
Contributor Author

amcdnl commented Apr 18, 2013

I like that ...

@wclr
Copy link
Contributor

wclr commented Apr 21, 2013

That is an old problem that happens sometimes "unexpectedly" is not resolved, and I always have to patch render.js each time I update.

@ccummings
Copy link
Contributor

Looks like the incremental live lists update in #362 has fixed this issue.

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

No branches or pull requests

4 participants