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

Updating RSX Too Fast Causes an Error on Desktop Windows #2229

Closed
DogeDark opened this issue Apr 2, 2024 · 1 comment · Fixed by #2246
Closed

Updating RSX Too Fast Causes an Error on Desktop Windows #2229

DogeDark opened this issue Apr 2, 2024 · 1 comment · Fixed by #2246
Assignees
Labels
bug Something isn't working desktop Suggestions related to the desktop renderer windows

Comments

@DogeDark
Copy link
Member

DogeDark commented Apr 2, 2024

Problem

When running a Desktop app on Windows 10, updating RSX quickly after it was rendered causes an error in the console.

Steps To Reproduce

Run this component on the Dioxus Desktop platform in a Windows environment.

fn app() -> Element {
    let mut data = use_signal(|| false);

    if data() {
        println!("RAN1");
        rsx!("true")
    } else {
        println!("RAN2");
        data.set(true);
        rsx!("false")
    }
}

Expected behavior

true should be displayed instead of false and there should be no errors.

Screenshots

This error is shown in the console when the true branch of the if statement is run.

image

Environment:

  • Dioxus version: main, 0.5
  • Rust version: 1.77.1
  • OS info: Windows 10
  • App platform: Desktop
@DogeDark DogeDark added bug Something isn't working desktop Suggestions related to the desktop renderer windows labels Apr 2, 2024
@jkelleyrtp jkelleyrtp added this to the 0.6.0: Devtools milestone Apr 2, 2024
@DogeDark
Copy link
Member Author

DogeDark commented Apr 3, 2024

This also happens with if, else if and else statements inside of RSX blocks:

fn app() -> Element {
    let mut data = use_signal(|| false);

    rsx! {
        if data() {
            "true"
        } else {
            {data.set(true)}
            "false"
        }
    }
}

Also happens on release.

Scratch this. It's not based on conditionals but rather seems based around how quickly a signal or hook is updated.

@DogeDark DogeDark changed the title Returning Early RSX Causes an Error on Desktop Windows Updating RSX Too Fast Causes an Error on Desktop Windows Apr 4, 2024
@ealmloff ealmloff self-assigned this Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working desktop Suggestions related to the desktop renderer windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants