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
I am trying to listen to the mounted event in a component to get it's size after it has been rendered. The problem is that I can't get it to work in the fullstack renderer (dioxus-fullstack). It does work in the web renderer (dioxus-web) however.
Steps To Reproduce
A small example of how I am using it:
use dioxus::html::geometry::euclid::Rect;use dioxus_fullstack::prelude::*;fnmain(){
dioxus_logger::init(log::LevelFilter::Debug).expect("failed to initialize logger");/* Works woth dioxus-web. */
dioxus_web::launch(App);/* Doesn't work with dioxus-fullstack. */// LaunchBuilder::new(App).launch();}pubfnApp(cx:Scope) -> Element{let size = use_state(cx,Rect::zero);
log::debug!("App");render!{
div {
onmounted: |event|
{
log::debug!("Mounted");
to_owned![size];async move {ifletOk(rect) = event.inner().get_client_rect().await{
size.set(rect);}}},"{size:?}"}}}
The problem is also reproducible in the following main() setup:
Using the web renderer will yield the output "App\nMounted\nApp" with the inner HTML "Rect(860.0x18.0 at (0.0, 0.0))". Using the fullstack renderer will yield the output "App" with the inner HTML "Rect(0.0x0.0 at (0.0, 0.0))". Expected behavior is that both methods should have the same output.
Environment:
Dioxus version: 0.4.3
Rust version: 1.74.1
OS info: macOS Monteray
App platform: fullstack
Questionnaire
I'm interested in fixing this myself but don't know where to start
I would like to fix and I have a solution
I don't have time to fix this right now, but maybe later
The text was updated successfully, but these errors were encountered:
Problem
I am trying to listen to the mounted event in a component to get it's size after it has been rendered. The problem is that I can't get it to work in the fullstack renderer (dioxus-fullstack). It does work in the web renderer (dioxus-web) however.
Steps To Reproduce
A small example of how I am using it:
The problem is also reproducible in the following
main()
setup:Expected behavior
Using the web renderer will yield the output "App\nMounted\nApp" with the inner HTML "Rect(860.0x18.0 at (0.0, 0.0))". Using the fullstack renderer will yield the output "App" with the inner HTML "Rect(0.0x0.0 at (0.0, 0.0))". Expected behavior is that both methods should have the same output.
Environment:
Questionnaire
The text was updated successfully, but these errors were encountered: