Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State management and event handling interact badly leading to stale state #3796

Open
1 of 3 tasks
mohe2015 opened this issue Jan 26, 2025 · 0 comments
Open
1 of 3 tasks
Labels

Comments

@mohe2015
Copy link

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

  • 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 mohe2015 added the bug label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant