-
Notifications
You must be signed in to change notification settings - Fork 196
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
#if _collection.any? around #each causes duplicate first item #36
Comments
Thanks for the heads up. I think I know why this might be happening. I'll try and get it fixed tomorrow. |
Forgot one major detail. The bug doesn't occur right away. You have to reload the page for it to trigger. |
Check https://github.com/derikson/todos3/tree/topic/issue-36 for a demonstration of this bug. That's branch topic/issue-36, not master. Go to blogs, enter a blog, then reload the page using the reload button in your browser. You should see a duplicate of the blog entry. |
I noticed |
Removing the #count method in ReactiveArray doesn't change anything, so it's just a coincidence. |
Stepping over the javascript, I found that the call to |
@derikson Thanks. I'm pretty sure the new reactive will fix this issue. Should be out early next week. |
@derikson Can you use volt 0.8 and see if you can duplicate this? (You might have to do a new app) I wasn't able to duplicate. Closing for now. Feel free to re-open. |
It can't replicate the bug anymore. Confirmed fixed. |
Thanks |
{#if _collection.any?}{#each _collection as c}{c.name}{/}{/} will cause the first item to be output twice, once at the beginning and once at the end. The same thing happens with .empty?, but does not happen with .size == 0.
You can test this by editing app/main/views/blog/edit.html in the todos3 app and wrapping the {#each _posts as post}{/} block with a {#if _posts.any?}{/} conditional.
The text was updated successfully, but these errors were encountered: