Skip to content

Fix external tree binding ignoring changes to ids on Reload - #6574

Merged
andydotxyz merged 3 commits into
fyne-io:developfrom
drakeo338:claude/6570-fix
Oct 24, 2026
Merged

andydotxyz merged 3 commits into
fyne-io:developfrom
drakeo338:claude/6570-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

Description:

Fixes #6570.

BindTree kept only a private copy of the ids map, so changes the caller made to the external ids (the nested structure) were never seen by Reload, and the tree showed up flat. The tree now keeps the pointer to the caller's map and re-reads it on reload; a nil map is created and written back so later appends are not lost. The sharing is documented on BindTree.

Checklist:

  • Tests included.
  • Lint and formatter run with no errors. (not run)
  • Tests all pass. (go test ./data/binding/)

Where applicable:

  • Public APIs match existing style and have Since: line. (no new API)
  • Any breaking changes have a deprecation path or have been discussed. (none)
  • Check for binary size increases when importing new modules. (no new imports)

BindTree kept only a private copy of the ids map, so nested changes made
to the external map were not seen by Reload. Keep the pointer and use the
live map when reloading.

Fixes fyne-io#6570
The tree shares the caller's ids map, so a nil map created for the
binding must be stored through the pointer or later appends are lost.
Document the sharing on BindTree.

@andydotxyz andydotxyz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking at this, two things came to mind when reviewing:

  • the "extIDs" (could just be ids like val is of similar externality) have a lot of nil checks - but val does not. When will the IDs be nil when the values are not?
  • there are many comments where not needed - particularly you should not document fixed bugs in function documentation.

@coveralls

coveralls commented Oct 6, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 61.448% (+0.1%) from 61.33% — drakeo338:claude/6570-fix into fyne-io:develop

Hold the ids as a pointer in treeBase, defaulting to a new map as val
does, so the bound tree reads and writes the caller's map directly.
This drops the separate extIDs field, its nil checks and the comments.
@drakeo338

Copy link
Copy Markdown
Contributor Author

treeBase.ids is now a *map[string][]string defaulting to a new map the same way val does, so extIDs and all its nil checks are gone, and the extra comments (including the BindTree doc note) are removed.

@andydotxyz andydotxyz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thanks for cleaning this up

@andydotxyz

Copy link
Copy Markdown
Member

The static analysis was fixed on develop, so merging

@andydotxyz
andydotxyz merged commit 0de3d85 into fyne-io:develop Oct 24, 2026
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

binding.ExternalTree.Reload does not respect binding's nested structure

3 participants