Skip to content

Commit 4c7e99c

Browse files
authored
feathers_gallery infinite update loop fix (#23827)
# Objective In the `feathers_gallery` example, on a `TextEditChange` `handle_hex_color_change` updates `DemoWidgetStates` which causes `update_colors` to update the hex input triggering another `TextEditChange`. ## Solution Only update `DemoWidgetStates` in `handle_hex_color_change` if the new color is different.
1 parent 911820f commit 4c7e99c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

examples/ui/widgets/feathers_gallery.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,9 @@ fn handle_hex_color_change(
713713
mut colors: ResMut<DemoWidgetStates>,
714714
) {
715715
let editable_text = *q_text_input;
716-
if let Ok(color) = Srgba::hex(editable_text.value().to_string()) {
716+
if let Ok(color) = Srgba::hex(editable_text.value().to_string())
717+
&& color != colors.rgb_color
718+
{
717719
colors.rgb_color = color;
718720
}
719721
}

0 commit comments

Comments
 (0)