settings ui: Fix dropdown menu rendering the same entries for different settings (#38083)

Using `window.use_state` made the element IDs match between elements,
thus causing the same menu to be shared for drop down menus. I switched
to `window.use_keyed_state` and used a value's path as it's element id

Release Notes:

- N/A
This commit is contained in:
Anthony Eid
2025-09-12 15:03:24 -04:00
committed by GitHub
parent 5f20b905a5
commit e4b754a19f

View File

@@ -909,7 +909,7 @@ fn render_dropdown(
let value = downcast_any_item::<String>(value);
let id = element_id_from_path(&value.path);
let menu = window.use_state(cx, |window, cx| {
let menu = window.use_keyed_state(id.clone(), cx, |window, cx| {
let path = value.path.clone();
let handler = Rc::new(move |variant: &'static str, cx: &mut App| {
SettingsValue::write_value(&path, serde_json::Value::String(variant.to_string()), cx);