Skip to content
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

Conditionals in looped <template> prevent previous items from being output #2769

Closed
bradisbell opened this issue Oct 10, 2019 · 3 comments
Closed

Comments

@bradisbell
Copy link

bradisbell commented Oct 10, 2019

  1. Describe your issue:

If using <template each="...">, the items inside <template> override each other in certain conditions:

  • When using text only (no non-text child elements of <template>)
  • When using conditional elements (like <p if="...">{something}</p>
  1. Can you reproduce the issue?

Yep!

https://plnkr.co/edit/BkD29KjxRdXtmy5BO3ub?p=preview

Change template to div and you'll see the differences.

  1. On which browser/OS does the issue appear?

Chrome v77 x64 on Windows 10

  1. Which version of Riot does it affect?

v4

  1. How would you tag this issue?

Bug

@GianlucaGuarini
Copy link
Member

@bradisbell your example seems to me an edge case since your html could be rewritten in a cleaner and reusable way
I will have a look at this issue but I will classify it as a low prio.
Thanks for reporting it

@bradisbell
Copy link
Author

bradisbell commented Oct 12, 2019

The example was the most trivial example I could think of, to make it easy to reproduce the bug in Riot.js. The reality in my application has a lot more to it, and the way it is structured makes sense for my application in-context.

There is also the text case, which isn't affecting me at the moment but I thought I'd point it out as it was unexpected.

Anyway, I'm able to use extra divs for now.

@GianlucaGuarini
Copy link
Member

Fixed in Riot.js@4.6.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants