DioxusLabs / dioxus

Fullstack GUI library for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
19.33k stars 736 forks source link

Dioxus fullstack livereload bugs out if using `use_server_future` with the automatic suspend functionality (i.e. ?) when sleeping #2193

Closed Silvea12 closed 3 months ago

Silvea12 commented 3 months ago

Problem

When refreshing your app with fullstack and a use_server_future() with a ? to suspend as per the docs, when using tokio sleep, the page infinitely reloads.

Steps To Reproduce

Steps to reproduce the behavior:

See this in the server logs:

Logs The blank line here is every time it pauses for the sleep. ``` [INFO] dioxus_fullstack::render - Suspense resolved [INFO] dioxus_fullstack::render - Rebuilding vdom [INFO] dioxus_signals::signal - new_maybe_sync; [INFO] dioxus_fullstack::hooks::server_future - First run of use_server_future [INFO] dioxus_fullstack::render - Rebuilding vdom [INFO] dioxus_signals::signal - new_maybe_sync; [INFO] dioxus_fullstack::hooks::server_future - First run of use_server_future [INFO] dioxus_fullstack::render - Suspense resolved [INFO] dioxus_fullstack::render - Suspense resolved [INFO] dioxus_fullstack::render - Rebuilding vdom [INFO] dioxus_signals::signal - new_maybe_sync; [INFO] dioxus_fullstack::hooks::server_future - First run of use_server_future [INFO] dioxus_fullstack::render - Rebuilding vdom [INFO] dioxus_signals::signal - new_maybe_sync; [INFO] dioxus_fullstack::hooks::server_future - First run of use_server_future [INFO] dioxus_fullstack::render - Suspense resolved ```

Expected behavior

It should not infinitely reload

Screenshots

N/A

Environment:

Questionnaire

ealmloff commented 3 months ago

I cannot reproduce this issue with dioxus 0.5.0 or the latest commit of the main branch of dioxus: https://github.com/ealmloff/reproduce-dioxus-fullstack-2193

The page takes 1 second to reload, but does not reload in a loop

Silvea12 commented 3 months ago

I can reproduce it with your demo. See the attached video. Screencast_20240402_021207.webm

... Strange github didn't embed this, I thought it did.