Calling suspense::use_future
makes children use_effect
hooks execution inconsistent.
#3780
Open
1 of 3 tasks
Labels
Problem
EDIT: This initially mentioned the
leaflet
library, but upon testing more, I ended up minimizing the example even further and getting rid ofleaflet
while still getting inconsistencies withsuspense::use_future
.The use of
suspense::use_future
makes subsequent uses ofuse_effect
execute before the DOM is updated, which is unexpected and inconsistent with the expected behavior.Steps To Reproduce
yew = { version = "0.21.0", features = ["csr"] }
oryew = { git = "https://github.com/yewstack/yew/", features = ["csr"] }
andweb-sys = { version = "0.3.76", features = ["HtmlElement"] }
.use_future
call breaks theget_element_by_id
call and makes the application panic.Expected behavior
I may misunderstand the usage of
use_effect
, but from what I understand, it is analogous to theComponent::rendered
method, and I would expect theuse_effect
(orComponent::rendered
) hook to be executed after the DOM has been updated in all cases.However when a suspension arises, the
use_effect
(orComponent::rendered
) hook seems to be executed before the updated DOM becomes available to the JS (web-sys
in this case) context.Debug tools logs
use_future
commented: nothing (expected).use_future
un-commented: panics with,Environment:
0.21.0
&&master
1.83
trunk
Questionnaire
Thanks for the awesome project by the way, it's a pleasure to do front-end in Rust 💯
The text was updated successfully, but these errors were encountered: