yew icon indicating copy to clipboard operation
yew copied to clipboard

State management and event handling interact badly leading to stale state

Open mohe2015 opened this issue 10 months ago • 2 comments

Problem When multiple events are handled without rerendering the state accessed in event callbacks is stale.

Steps To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/mohe2015/yew-bug
  2. (cd frontend && trunk serve)
  3. (cd tests && cargo run)
  4. Open browser console in opened firefox (note: firefox will automatically close after 30 seconds)

Expected behavior I expected the browser console to contain username: username, password: password but it contains username: username, password: (password missing). When clicking on the login button again the correct text is shown. This is only an issue in Firefox but not Chromium. From the logs it seems like a rerender is required to update the value in the handle.

Screenshots Image

Environment:

  • Yew version: 0.20 until master are all affected
  • Rust version: nightly
  • Build tool, if relevant: trunk
  • OS, if relevant: Linux
  • Browser and version, if relevant: Firefox

Questionnaire

  • [x] 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

mohe2015 avatar Jan 26 '25 19:01 mohe2015

@mohe2015 I can work on this issue. Can I get it assigned as part of Hacktober fest 2025?

akilesh1706 avatar Oct 05 '25 10:10 akilesh1706

Btw I'm not a project member, so I can't help you with the hacktoberfest part. I think this project is relatively inactive currently.

mohe2015 avatar Oct 07 '25 08:10 mohe2015