You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnmain(){launch(client_mod::client_lib::Client);}pubfnClient() -> Element{println!("Client");spawn(asyncmove{// do some async things here}}
I found that if something changed, the Client(main App component) will be rendered again, so the Client will be printed many times. So that the spawn will generate many times.
Expected behavior
Is there a way could spawn new thread in fn main or other places, so I could just spawn a new thread once just like launch().
Screenshots
If applicable, add screenshots to help explain your problem.
Environment:
Dioxus version: 0.5.1
Rust version: 1.7.75
OS info: MacOS
App platform: desktop
The text was updated successfully, but these errors were encountered:
fnmain(){launch(client_mod::client_lib::Client);}pubfnClient() -> Element{println!("Client");spawn(asyncmove{// do some async things here}}
I found that if something changed, the Client(main App component) will be rendered again, so the Client will be printed many times. So that the spawn will generate many times.
Expected behavior Is there a way could spawn new thread in fn main or other places, so I could just spawn a new thread once just like launch().
Screenshots
If applicable, add screenshots to help explain your problem.
Environment:
Dioxus version: 0.5.1
Rust version: 1.7.75
OS info: MacOS
App platform: desktop
We have use_future, use_effect, and use_hook depending on how much abstraction you need.
@jkelleyrtp thanks for the reply. but I found that to use the spawn() in the top element fn() could solve the problem. We should move the values that would be rerendered in the child component.
Problem
Steps To Reproduce
Steps to reproduce the behavior:
Client(main App component)
will be rendered again, so theClient
will be printed many times. So that the spawn will generate many times.Expected behavior
Is there a way could spawn new thread in
fn main
or other places, so I could just spawn a new thread once just like launch().Screenshots
If applicable, add screenshots to help explain your problem.
Environment:
desktop
The text was updated successfully, but these errors were encountered: