Using scene patch to update items in FeathersListView leads to strange results
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version and features
- Bevy 0.19 with features 2d, ui, bevy_feathers
## What you did
Ran the following program:
```rust
use bevy::{
feathers::{
FeathersPlugins,
containers::*,
controls::*,
dark_theme::create_dark_theme,
theme::{ThemeBackgroundColor, ThemedText, UiTheme},
tokens,
},
input_focus::tab_navigation::TabGroup,
prelude::*,
ui::Selected,
ui_widgets::listbox_update_selection,
};
#[derive(Component, Clone, Default)]
struct NeedsPopulate;
fn main() {
App::new()
.add_plugins((DefaultPlugins, FeathersPlugins))
.insert_resource(UiTheme(create_dark_theme()))
.add_systems(Startup, scene.spawn())
.add_systems(Update, do_update)
.run();
}
fn do_update(
mut timer: Local>,
time: Res
fn scene() -> impl SceneList {
bsn_list![Camera2d, demo_root()]
}
fn demo_root() -> impl Scene {
bsn! {
Node {
width: percent(100),
height: percent(100),
align_items: AlignItems::Start,
justify_content: JustifyContent::Start,
display: Display::Flex,
flex_direction: FlexDirection::Row,
column_gap: px(8),
}
TabGroup
ThemeBackgroundColor(tokens::WINDOW_BG)
Children[
demo_column_2(),
]
}
}
fn demo_column_2() -> impl Scene {
bsn! {
Node {
display: Display::Flex,
flex_direction: FlexDirection::Column,
align_items: AlignItems::Stretch,
justify_content: JustifyContent::Start,
padding: px(8),
row_gap: px(8),
width: percent(30),
min_width: px(200),
}
Children [
subpane() Children [
subpane_header() Children [
(Text("List") ThemedText),
],
subpane_body() Children [
NeedsPopulate
@FeathersListView
Node {
max_height: px(130)
}
on(listbox_update_selection)
],
]
]
}
}
```
## What went wrong
In addition to the items updating inside the list view, there's a weird ghost of the list view content at the top of the window and the entire viewport now has a scrollbar.
I don't see why this way of updating the ListView would go wrong in this way. If there is an explanation then at a minimum I think there should be some documentation somewhere about how to add items to a FeathersListView programatically after scene initialization.
Contributor guide
Research direction
Run the provided Bevy 0.19 reproduction and start by tracing FeathersListView updates through apply_scene and listbox_update_selection. Check how the bsn! list patch handles existing children, then verify that updating rows does not create ghost content or a viewport scrollbar. Document the supported way to add items after scene initialization if the behavior is intentional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100