Closed jsunsch closed 6 years ago
Thank you very much for calling this out! I'll investigate and let you know...
Here is a proposed fix. Let me know if it doesn't fix the problem, or if you see other issues. Thanks!
I replaced yesterday's fix with an update, above, which addresses another bug. (The code for this {^{for}}{{else}} issue is unchanged though)...
The updated version you posted seems to have fixed the issue. Thank you very much! :) It seems that the v0.9.89 version contains other code changes unrelated to this issue as well. Can you point me in the direction where in the code this particular issue was fixed? (Just out of pure curiosity)
Yes, that is my working copy for the next update, which has several changes.
The changes for this issue were in onArrayChange for the for tag. It was a regression from commit 86 - primarily here:
https://github.com/BorisMoore/jsviews/blob/master/jsviews.js#L6617
It's true the code is not always easy to understand and debug :)
This has been fixed in commit 89
Hello, I have been tingering with an issue that i encountered today.
I have a data-linked array which i render using a {^{for}} ... {{else}} ... {{/for}}. When only a single entry has been added to the array and is removed again, the removed entry is rendered together with the content inside the {{else}} block. I have attached a test-html file which proves this issue on as minimal a setup as i could muster. Data_linked_for_loop.zip
Interestingly enough, i also encountered the error on the JsViews documentation site: http://www.jsviews.com/#jsvfortag
Steps to reproduce on the documenation portal: 1) Load the site 2) Remove the Robert and Sarah entries in the first example 3) Click the Add or Replace buttons
The result should be that one or more entries are added, but the text "There are no members" remains.
I have encountered the error in the following browsers: Google Chrome Version 61.0.3163.100 Mozilla Firefox Version 55.0.3 (32-bit) Internet Explorer Version 11.0.9600.18762
I'm a regular user of both the JsRender and JsViews libraries, and would love to aid in debugging, but after 4 hours of doing so, i realise the libraries are quite complex! :)