#3256·yew

Conditional Rendering and Children component interact strangely

Author: sinistersnareCreated May 3, 2023Updated Apr 8, 2026

Problem I am trying to conditionally render some HTML that goes through a Children component. When using enumerate() on the Children iterator, should-be-skipped components are rendered anyways.

Steps To Reproduce Steps to reproduce the behavior:

  1. Go to https://play.yew.rs/?shared=VQIs2qSmnXjGJl8OYX5s and run it.
  2. Notice that C is not rendered, but is still given an iteration.

Expected behavior The enumerator should only give 3 iterations, skipping the would-be C iteration.

I assume that the x iterator is getting some ghost value at some point. Can I just check for that instead as a workaround? What would that look like?

Environment:

Whatever is on Yew playground on May 3, 2023

  • Browser and version, Firefox 112, did not try on others.

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later