-
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
Observable change error, when loading jquery.observable.js before jsrender.js, and using contextual parameters and sorted {{for}} #446
Comments
Thanks, Johann. Another good find. That is a bug which arises in the case of having jquery.observable.js and jsrender.js and jquery,views.js as separate files, with jquery.observable.js loaded before jsrender.js. I have repro. I believe that if you load jsrender.js first or use jsviews.js (single file) the issue will not occur. I'll work to get a fix, then let you know here... |
Great! Once I have this fixed I can push the new version into production. |
Hi Johan, I think this should fix the issue: Let me know if it works for you. (It also includes a fix to jsrender-node.js, and your issue #447 (comment)) |
An other related potential? issue is the following. In jquery.views.js on line 3184:
The compiled function returned by tmplFn() have both j and u input parameters but the call only passes in data and the view. There are a number of places where a similar call is made without passing in the extra parameters. I can't actually remember if I had an issue with it or not. |
You are right!! Thanks... It is difficult to make a bug scenario that encounters that as an issue, but I managed to do so with this:
which I will add to the unit tests. So I have fixed it in the update below, to pass in
The Here is the update: |
Feature improvements for JsRender on Node.js: (See issue BorisMoore/jsrender#357) - File based templates for JsRender on Node.js now allow absolute paths See the updated documentation topic: https://www.jsviews.com/#node/filetmpls@htmlfile - The renderFile() method for JsRender on Node.js now allows passing of context and helpers as well as data See the new documentation topic: https://www.jsviews.com/#node/filetmpls@renderfilehlelpers Performance optimization changes: - BorisMoore/jsviews#448 $.observe/$.unobserve performance degradation over time - BorisMoore/jsviews#447 removeView performance Several bug fixes, including: - BorisMoore/jsviews#446 Observable change error, when loading jquery.observable.js before jsrender.js, and using contextual parameters and sorted {{for}} - BorisMoore/jsviews#440 linked tag property changed handler called when it shouldn't - BorisMoore/jsviews#445 jsrender.min.js.map truncated Additional small corrections or improvements to documentation and some additional unit tests...
Feature improvements for JsRender on Node.js: (See issue BorisMoore/jsrender#357) - File based templates for JsRender on Node.js now allow absolute paths See the updated documentation topic: https://www.jsviews.com/#node/filetmpls@htmlfile - The renderFile() method for JsRender on Node.js now allows passing of context and helpers as well as data See the new documentation topic: https://www.jsviews.com/#node/filetmpls@renderfilehlelpers Performance optimization changes: - #448 $.observe/$.unobserve performance degradation over time - #447 removeView performance Several bug fixes, including: - #446 Observable change error, when loading jquery.observable.js before jsrender.js, and using contextual parameters and sorted {{for}} - #440 linked tag property changed handler called when it shouldn't - #445 jsrender.min.js.map truncated Additional small corrections or improvements to documentation and some additional unit tests...
This has been fixed in new release v1.0.7 |
Sorry about the poor title.
Anyway I found this issue.
I have this for-tag:
I do something to trigger pagingEndIdx to change and this ends up calling this code in jquery.observable.js:
The line
var newTagCtx = linkCtx.fn(linkCtx.data, linkCtx.view, $sub)[options.index]; // Updated tagCtx props and args
is the culprit.$sub does not contain everything the compiled view function expect. If I instead change the above line to this:
var newTagCtx = linkCtx.fn(linkCtx.data, linkCtx.view, $.views.sub)[options.index]; // Updated tagCtx props and args
then it work.The compiled view function look like this:
Notice how it wants to call j._cp(...). That function is not present on$sub but it is on $ .views.sub
I hope you can spot the error and a fix for it. If not I can try to reproduce the error with simpler code.
The text was updated successfully, but these errors were encountered: