Description
When iterating over a WireList, WireDict, or WireSet in a template using $for, the iteration does not automatically track the container as a dependency. This is because these classes lack custom __iter__ methods that call self._track_read().
Reproduction Steps
- Create a
.wire file with a WireList.
- Use
$for to iterate over the list in the template.
- Update the list (e.g., using
append).
- Observe that the list rendering does not update.
Expected Behavior
The list should be tracked as a dependency during iteration, and updates to the list should trigger a re-render of the $for region.
Proposed Fix
Implement __iter__ (and __contains__) in WireList, WireDict, and WireSet that call _track_read() before delegating to the superclass.
Description
When iterating over a
WireList,WireDict, orWireSetin a template using$for, the iteration does not automatically track the container as a dependency. This is because these classes lack custom__iter__methods that callself._track_read().Reproduction Steps
.wirefile with aWireList.$forto iterate over the list in the template.append).Expected Behavior
The list should be tracked as a dependency during iteration, and updates to the list should trigger a re-render of the
$forregion.Proposed Fix
Implement
__iter__(and__contains__) inWireList,WireDict, andWireSetthat call_track_read()before delegating to the superclass.