-
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
Binding to computed functions: onBind callback called twice. If computed function has no setter , "... is not a function" exception thrown #451
Comments
Thank you very much for posting this. It's a good catch. I'll need to do some investigation... I'll let you know... |
Here is a potential update that should address your issues. Can you test that it works correctly for you? Incidentally, your example is data-linking to util1(), as if it was a computed observable, but for the binding to work, it needs an associated setter function. See https://www.jsviews.com/#computed@getset. For example, you could write:
If you provide a setter, as above, the "view.ctxPrm(...) is not a function" exception will not be thrown. But with the jsviews.js update provided there will no longer be any exception, even if you don't provide a setter. (Though of course two-way binding will not work unless there is a setter defined...) Let me know if this works for you... |
Thank you, Boris. The update resolves both throwing the exception and double onBind event. |
Thanks for confirming. I except to include this in the upcoming version 1.0.10. |
The fix concerns two issues:
|
Minor bug fixes: See BorisMoore/jsviews#451 - Binding to a computed function with no getter, such as <input data-link="name()"/> with name.set undefined leads to an exception: "name is not a function". - Tag two-way binding to a computed observable, such as {^{mytag name()/}} can trigger onBind callback twice.
Minor bug fixes: See BorisMoore/jsviews#451 - Binding to a computed function with no getter, such as <input data-link="name()"/> with name.set undefined leads to an exception: "name is not a function". - Tag two-way binding to a computed observable, such as {^{mytag name()/}} can trigger onBind callback twice.
Minor bug fixes: See #451 - Binding to a computed function with no getter, such as <input data-link="name()"/> with name.set undefined leads to an exception: "name is not a function". - Tag two-way binding to a computed observable, such as {^{mytag name()/}} can trigger onBind callback twice.2
Fixed in release v1.0.10 |
Hi,
Please take a look at this abstract case:
With JsViews versions 1.0.5 and earlier this worked, but starting from 1.0.6 and up to 1.0.9 the "view.ctxPrm(...) is not a function" exception is thrown. Now let's remove "Param1" from bindTo and linkedCtxParam:
Now the exception is not thrown, but onBind callback method is called twice. With versions prior 1.0.6 onBind is called only once.
The text was updated successfully, but these errors were encountered: