DioxusLabs/dioxus

Writing a value to a signal inside a `Closure` triggers infinite rerender warning

Closed this issue ยท 0 comments

Sup! ๐Ÿ‘‹

While working on a scroll-to-anywhere component for WASM frameworks, including Dioxus, I encountered an issue where updating a signal inside a wasm_bindgen::closure::Closure leads to an infinite rerender warning being thrown.

Screenshot from 2024-12-19 01-30-20

However, the app behaves as expected, and no actual infinite loop occurs.

Steps to Reproduce:

  1. Clone this repo: https://github.com/opensass/scroll-rs/tree/main/examples/dioxus.
  2. Follow the steps in the README to set up the project.
  3. Observe the warning triggered in the console when the signal update happens inside the closure.

Expected Behavior:

No infinite rerender warning unless there's an actual issue.

Additional Info:

  • The app works as intended despite the warning. Check out the deployed demo: https://scroll-rs-dioxus.netlify.app
  • The issue could be related to how the closure interacts with the signal.

Would love your thoughts!

Best!