Skip to content

Fix changing widget IDs and false-positive ID change warnings across passes - #8316

Open
vlansco wants to merge 7 commits into
emilk:mainfrom
vlansco:stable-table-cell-ids
Open

Fix changing widget IDs and false-positive ID change warnings across passes#8316
vlansco wants to merge 7 commits into
emilk:mainfrom
vlansco:stable-table-cell-ids

Conversation

@vlansco

@vlansco vlansco commented Jul 15, 2026

Copy link
Copy Markdown
  • I have followed the instructions in the PR template

Virtualized tables could shift the parent UI's automatic ID sequence between sizing and rendering passes.

StripLayout::skip_space represented non-visible rows using allocate_rect(..., Sense::hover()). This preserved the scroll extent, but also registered a hover widget and consumed an automatic widget ID. When virtual buffers differed between passes, subsequent table widget IDs changed and triggered warnings such as:

Widget rect changed id between passes

Multi-pass and data-driven layouts can also legitimately move existing widgets into vacated rects or intentionally replace all widgets within a region. These cases could produce the same warning even though the widget IDs were stable or the replacement was intentional.

This PR:

  • uses expand_to_include_rect for virtual row buffers, preserving the scroll extent without registering a widget or consuming an automatic ID;
  • assigns deterministic IDs to table header, body, and cell UIs;
  • avoids warnings when an existing widget moves into a rect vacated during the previous pass, while retaining warnings for genuinely new IDs replacing widgets in place;
  • adds Context::allow_widget_id_changes_in as a pass-local, rect-scoped exclusion for regions that intentionally replace their widget set;
  • adds regression coverage for virtual spacer extent, automatic ID preservation, moved widgets, genuine replacements, and scoped exclusions.

There are no intended visual changes. The only public API change is Context::allow_widget_id_changes_in, which affects this diagnostic only; it does not change duplicate-ID checks or widget interaction.

Testing

  • cargo test -p egui -p egui_extras
  • cargo clippy -p egui -p egui_extras --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check

Screenshots are not applicable because these changes do not affect visual output.

lucasmerlin and others added 3 commits July 15, 2026 18:53
- expand virtual row buffers without registering hover widgets
- preserve scroll extent without consuming automatic widget ids
- cover spacer extent and id behavior with a regression test
- stabilize table container ids
- stabilize table cell ui ids
@github-actions

Copy link
Copy Markdown

Preview is being built...

Preview will be available at https://egui-pr-preview.github.io/pr/8316-stable-table-cell-ids

View snapshot changes at kitdiff

vlansco added 2 commits July 15, 2026 21:51
- suppress rect/id warnings when the new id existed in the previous pass
- retain diagnostics for genuinely new ids replacing widgets in place
- cover both cases with focused regression tests
- add a pass-local API for intentional widget-set replacements
- exclude only widgets contained by explicitly marked rects
- preserve duplicate-id checks and normal interaction behavior
@vlansco vlansco changed the title Fix widget IDs changing between passes in virtualized tables Fix changing widget IDs and false-positive ID change warnings across passes Jul 15, 2026
@vlansco
vlansco marked this pull request as draft July 17, 2026 11:52
@vlansco
vlansco marked this pull request as ready for review July 17, 2026 12:54
@vlansco
vlansco marked this pull request as draft July 20, 2026 10:58
@vlansco
vlansco marked this pull request as ready for review July 20, 2026 11:28
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.

2 participants