You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A clear and concise description of what the bug is.
When a panic occurs within the set_interval_with_handle callback and there is a RefCell that has been borrowed. The borrowed RefCell isn't resolved, so when the interval callback runs again, it throws a "already borrowed: BorrowMutError".
Leptos Dependencies
[dependencies]
leptos = { version = "0.6", features = ["csr", "nightly"] }
leptos_meta = { version = "0.6", features = ["csr", "nightly"] }
leptos_router = { version = "0.6", features = ["csr", "nightly"] }
console_log = "1"
log = "0.4"
console_error_panic_hook = "0.1"
To Reproduce
Steps to reproduce the behavior:
Create an interval callback that panics after calling {RefCell}.borrow_mut()
Check the console log and it will have a secondary error from trying to make that borrow again
Expected behavior
This may be expected behavior; however, I can't imagine why as it makes debugging more difficult because it will keep repeating the borrow error and it makes it hard to debug the original error that caused the problem.
The text was updated successfully, but these errors were encountered:
There is no way that I'm aware of to gracefully recover from panics in WASM, which means that if you cause a panic in user-land code there is no way for the framework to do things like unregister any timers or even listeners that have been registered.
(Unless I'm misunderstanding what you're saying, in which case: please provide a reproducible example.)
No, sounds like you got it. In that case, is this documented somewhere? Because I would categorize this as unexpected behavior and I think it should be mentioned somewhere in the docs for set_interval_with_handle/set_interval.
I do not know if this is documented somewhere. I learned it somewhere in my last few years of working with Rust/WASM. If you Google "Rust WASM panic" you can find plenty of discussion of the above but I don't see an obvious place in Rust docs. A very good description of basically what you describe above is found in this StackOverflow post.
Feel free to make a PR for the docs for set_interval... saying that panics in the handler will not cancel the interval, and that panics in general in WASM are not recoverable and there is no coherent way to respond to them short of reloading the page.
Describe the bug
A clear and concise description of what the bug is.
When a panic occurs within the
set_interval_with_handle
callback and there is a RefCell that has been borrowed. The borrowed RefCell isn't resolved, so when the interval callback runs again, it throws a "already borrowed: BorrowMutError".Leptos Dependencies
[dependencies]
leptos = { version = "0.6", features = ["csr", "nightly"] }
leptos_meta = { version = "0.6", features = ["csr", "nightly"] }
leptos_router = { version = "0.6", features = ["csr", "nightly"] }
console_log = "1"
log = "0.4"
console_error_panic_hook = "0.1"
To Reproduce
Steps to reproduce the behavior:
{RefCell}.borrow_mut()
Expected behavior
This may be expected behavior; however, I can't imagine why as it makes debugging more difficult because it will keep repeating the borrow error and it makes it hard to debug the original error that caused the problem.
The text was updated successfully, but these errors were encountered: