Skip to content

Tree example doesn't parent items correctly #4111

@corranwebster

Description

@corranwebster

Describe the bug

When you click on the "insert row" button in the example app, new rows get added to the 1940s root, except for those in the 2000s.

Steps to reproduce

Run the tree example app and click on "insert row" a few times.

Expected behavior

Items should be correctly distributed by decade.

Screenshots

Image

Environment

  • Operating System: MacOS (I don't think this matters)
  • Python version: 3.13.9 (this might matter)
  • Software versions:
    • Toga: current main branch

Logs

No response

Additional context

This looks like it was introduced in #4000. I think

if year := item["year"] >= 2000:

should read

if (year := item["year"]) >= 2000:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions