Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix volatile attributes #2278

Merged
merged 1 commit into from
Apr 9, 2024
Merged

Conversation

ealmloff
Copy link
Member

@ealmloff ealmloff commented Apr 8, 2024

This PR fixes diffing volatile attributes. Any volatile attributes should always be written even if the value appears not to have changed because the browser may have changed the attribute. This fixes this example:

use dioxus::prelude::*;

fn main() {
    launch(app);
}

fn app() -> Element {
    let mut count = use_signal(|| 0);

    rsx! {
        input {
            value: count,
            r#type: "number",
            oninput: move |evt| {
                if let Ok(value) = evt.value().parse::<i64>() {
                    if value < 0 {
                        count.set(0);
                    }
                    else {
                        count.set(value);
                    }
                }
            },
        }
    }
}

@ealmloff ealmloff added bug Something isn't working core relating to the core implementation of the virtualdom labels Apr 8, 2024
@jkelleyrtp jkelleyrtp merged commit 26c109f into DioxusLabs:main Apr 9, 2024
8 of 9 checks passed
@ealmloff ealmloff deleted the fix-volitile branch April 9, 2024 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core relating to the core implementation of the virtualdom
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants