-
Notifications
You must be signed in to change notification settings - Fork 130
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
Stack overflow using .depends function with computed observable #334
Comments
Hi Paul, Thanks for calling this out. Yes, it is a regression. Here is my current version, with a fix for that: What is happening is that in your code
Let me know if you still see issues with this update... |
Thanks Boris! This does indeed resolve the issue. That was a scaled down snippet of the code I actually use. In this case I use an overloaded definition of selected for which some menus it is initialized (and remains) null and for others it is initialized to a valid value. With depends, is there a difference between: [this.selected(), 'enabled'] and ['selected.enabled'] ? Also, will ['selected^enabled'] pick up the dependency if selected is undefined at the time of binding and later observably updated? I suspect not and I don't rely on this, but am curious. As always, thanks for all your great work! On Mar 2, 2016, at 1:28 PM, Boris Moore notifications@github.com wrote:
|
Simply setting
If you haven't seen it, you should probably take a look at http://www.jsviews.com/#computed@depends. There is a new feature of calling a callback in the depends function style declaration which will give you additional programmatic power if you need it. Note that it allows you (for example) to observe all changes - equivalent to the new |
Wow. Amazing! Thanks for the explanation Boris.
|
Updates and new documentation topics: - Important updates and improvements to $.views.settings APIs: settings.allowCode(), settings.delimiters(), settings.debugMode() plus new settings.advanced(). See new documentation at www.jsviews.com/#settings and www.jsviews.com/#jsvsettings - Support for unobserve() is now complete (and simplified): See updated documentation topic: www.jsviews.com/#unobserve - Support for namespaces associated with observable changes is now complete: See new documentation topic: www.jsviews.com/#namespaces - Support for error handling and debugging improved and extended, with some small changes to APIs - including for $.views.settings.debugMode, with full documention at www.jsviews.com/#onerror - {{>}} is now equivalent to {{>#data}} Minor breaking changes: - $.observe(arr, "length", callback) now only listens to length, not to array changes but $.observe(arr, arr, "length", callback) listens to both length and array changes - Namespaces with observeAll: $.observable(objectOrArray).observeAll(namespace, handler) is now written: $.observable(namespace, objectOrArray).observeAll(handler) - and similarly for .unobserveAll() - JsRender and JsViews no longer use the (0, eval)('this') expression to get the window object. This means that they can now be minified by the Visual Studio minifier, in spite of it not correctly minifying this expression. See BorisMoore/jsviews#323 Bug fixes: - BorisMoore/jsviews#334 (computed observable - depends) - Several additional small bug fixes - This update also includes a security fix
Updates and new documentation topics: - Important updates and improvements to $.views.settings APIs: settings.allowCode(), settings.delimiters(), settings.debugMode() plus new settings.advanced(). See new documentation at www.jsviews.com/#settings and www.jsviews.com/#jsvsettings - Support for unobserve() is now complete (and simplified): See updated documentation topic: www.jsviews.com/#unobserve - Support for namespaces associated with observable changes is now complete: See new documentation topic: www.jsviews.com/#namespaces - Support for error handling and debugging improved and extended, with some small changes to APIs - including for $.views.settings.debugMode, with full documention at www.jsviews.com/#onerror - {{>}} is now equivalent to {{>#data}} Minor breaking changes: - $.observe(arr, "length", callback) now only listens to length, not to array changes but $.observe(arr, arr, "length", callback) listens to both length and array changes - Namespaces with observeAll: $.observable(objectOrArray).observeAll(namespace, handler) is now written: $.observable(namespace, objectOrArray).observeAll(handler) - and similarly for .unobserveAll() - JsRender and JsViews no longer use the (0, eval)('this') expression to get the window object. This means that they can now be minified by the Visual Studio minifier, in spite of it not correctly minifying this expression. See #323 Bug fixes: - #334 (computed observable - depends) - Several additional small bug fixes - This update also includes a security fix
This fix has now been committed. Closing. (Please re-open if you still see any issues!) |
Hello Boris,
I've run into what appears to be a regression when using .depends functions with computed observables. In this case I am using them to create context sensitive menus that change based on the selected item. This jsfiddle reproduces the issue.
https://jsfiddle.net/PaulMartin/d51emo1x/
In short if I use this syntax the stack is blown:
but if I use this syntax (which I believe to be functionally equivalent) it is not
In the fiddle, you can just comment / uncomment to see the stack overflow.
I had been using the first syntax for quite some time and upgraded to the latest version from 64 yesterday when I encountered this issue. Judging from the change logs, I would guess the enhancements made in commit 72 introduced this issue.
Please let me know if I can provide you any additional information.
The text was updated successfully, but these errors were encountered: