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

Recursive Observers result in stack overflow #27

Closed
WearyMonkey opened this Issue Apr 6, 2012 · 5 comments

Comments

Projects
None yet
2 participants
@WearyMonkey
Contributor

WearyMonkey commented Apr 6, 2012

var a = new can.Observe();
var b = new can.Observe({a: a});
a.attr("b", b);

The above code will result in a stack overflow during the event bubbling phase of setting b.

@WearyMonkey

This comment has been minimized.

Show comment
Hide comment
@WearyMonkey

WearyMonkey Apr 6, 2012

Contributor

My current workaround, checking for recursion before triggering: c2a002a78214170ed27e1d2dad63fcbda6ba14c0

Contributor

WearyMonkey commented Apr 6, 2012

My current workaround, checking for recursion before triggering: c2a002a78214170ed27e1d2dad63fcbda6ba14c0

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Apr 6, 2012

Contributor

checking it out

Contributor

justinbmeyer commented Apr 6, 2012

checking it out

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Apr 6, 2012

Contributor

Why do you have a recursive observe?

Contributor

justinbmeyer commented Apr 6, 2012

Why do you have a recursive observe?

justinbmeyer added a commit that referenced this issue Apr 6, 2012

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Apr 6, 2012

Contributor

I pulled this. Thanks! If you could let me know why you created a recursive observe. I was thinking directed acyclic.

Contributor

justinbmeyer commented Apr 6, 2012

I pulled this. Thanks! If you could let me know why you created a recursive observe. I was thinking directed acyclic.

@WearyMonkey

This comment has been minimized.

Show comment
Hide comment
@WearyMonkey

WearyMonkey Apr 8, 2012

Contributor

Cheers!

Recursive observes are required for associative models which I talked about here: https://forum.javascriptmvc.com/#Topic/32525000000711090

I have been porting our ActiveRecord style models to CanJS.
You can see the work in progress here: https://github.com/WearyMonkey/can_associate

Contributor

WearyMonkey commented Apr 8, 2012

Cheers!

Recursive observes are required for associative models which I talked about here: https://forum.javascriptmvc.com/#Topic/32525000000711090

I have been porting our ActiveRecord style models to CanJS.
You can see the work in progress here: https://github.com/WearyMonkey/can_associate

justinbmeyer added a commit that referenced this issue Jun 1, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment