Skip to content

[Bug] WireList, WireDict, and WireSet are not reactive during iteration #20

@reecelikesramen

Description

@reecelikesramen

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

  1. Create a .wire file with a WireList.
  2. Use $for to iterate over the list in the template.
  3. Update the list (e.g., using append).
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions