-
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
Minor 'View Model' conditional issue & data-link with () or without #464
Comments
Hi Brent - here is a candidate fix for issues 463 464 465 and 466. The wrapping parenthesis should be OK now. (But this was a tricky bug to fix - deep in the parsing code...) If you are using a ViewModel hierarchy as data, and then you include |
The wrapping parenthesis now work...although of course I never intended, nor will use it that way. Thanks for fixing what 'seemed' like a minor issue, much appreciated! Yes, thanks for confirming what I was thinking regarding VM instances and using properties with or without |
I'm glad you did point out the issue with wrapping parenthesis, since one never knows whether an 'avoidable' issue like that is not hiding an internal coding error which in other scenarios might appear again and not be at all avoidable. As for opinionated, yes, it make sense to be opinionated when using VMs. But temporary patching in of 'untyped' properties might be useful for some testing scenarios, or whatever... So it's good to know you can do it... |
I found a line of code that broke when using candidate v16...
|
This works for me, with candidate v16A:
If it fails for you, can you check whether there is some other issue - or provide a small repro? |
Hi Boris, I sent you test file testCanidate16A_forBoris.html...sorry, no small file. HTML line in question: Using Candidate v16A
Using v15 Following the same test steps above...in step 4, |
Hi Boris, I am guessing you figured out what the problem was here...it does seem that parsing of parentheses is still an issue... Does not work, but should tag does not refresh Works tag refreshes UPDATE: Best, |
I am working on this, or related. The problem seems to be when there is a final
Changing valueA() triggers the refresh but changing name() does not. Adding a depends like this makes the refresh work
...working on it.... |
Hi Boris,
I am converting plain objects/arrays project to use View Models.
I had one line that threw me for a loop ;-)
View Model
if
tag fails silently to refresh when togglingIsEditing
value for instance.{^{if ~root.IsEditing() && (valueA() == 0 && valueB() == 0 && valueB() == 0)}}
Fix and obvious oversight...remove the wrapping parenthesis (no functional change).
{^{if ~root.IsEditing() && valueA() == 0 && valueB() == 0 && valueB() == 0}}
Plain objects/arrays
No issues here, refresh occurred when toggleing
IsEditing
with wrapping parenthesis.{^{if ~root.IsEditing && (valueA == 0 && valueB == 0 && valueB == 0)}}
Here is one of your modified samples...click on
Change name
to see the issue.https://jsfiddle.net/alnico/a20ygm81/
To test, click on
Change name
button.data-link with () or without
Also, I noticed when making the switch from plain objects/arrays to View Models that properties will work without the () when not defined in the model, is this intended or simply a side effect. If intentional, what is the use case? The data is also included when unmapped. This has me a bit confused ;-)
This works in a View Model:
data-link="someCheckbox"
no()
UPDATE: I forgot a person can use View Models with JsRender too...so using it the way I described above with JsViews just does not allow you to use getters and setters?
The text was updated successfully, but these errors were encountered: