#`<select>` not updating options with `onchange`

1 messages · Page 1 of 1 (latest)

ripe kayak
#

I have a select that should set its selected = true value when a specific condition is met, yet when I load the app and modify the select's value, all of the options within it don't change.
None of them even start with the Basic option with selected = true. I'm a little confused; what should I do to get this working?

select {
    onchange: move |evt| {
        CHARACTER
            .with_mut(|character| {
                character.skills[i].quality = match evt.value().parse::<usize>().unwrap()
                {
                    1 => Quality::Adept,
                    2 => Quality::Superb,
                    _ => Quality::Basic,
                }
            });
    },
    option { value: 0, selected: CHARACTER().skills[i].quality == Quality::Basic, "Basic" }
    option { value: 1, selected: CHARACTER().skills[i].quality == Quality::Adept, "Adept" }
    option { value: 2, selected: CHARACTER().skills[i].quality == Quality::Superb, "Superb" }
}
cursive pebble
#

Are you using dioxus fullstack?

ripe kayak
#

No, web and desktop

#

Both cases have the same behaviour

#

I'm not sure how to set this in general - it happens when loading these values too. Under the hood when you load in, the values are what they should be, but the HTML doesn't update to reflect it.

cursive pebble
#

Hmm, does changing the values to strings help?

ripe kayak
#

Like selected: ... { "true" } else { "false" }?

#

oh hold on

#

Either way yields this same result of not working. I also have the same exact issue on a different project

ripe kayak
#

@cursive pebble Any idea how I can fix this?

ripe kayak
#

This is also ocurring with other inputs. Text input being imported and filling their value fields see no effect.

cursive pebble
#

This definitely seems like a bug...

#

value is slightly special in dioxus: It is volatile which means it is set every time the component is rerun even if the value doesn't change (it isn't diffed)

#

Could you open an issue?