-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[bug] tauri v2.0.x 'unlisten' work strangely #8916
Comments
I've located the bug, I'll try to upload a pr to fix it. |
In this pr |
fix clear residual listeners tauri-apps#8916
this bug will be fixed in next release beta verison? |
It's not up to me, but I did fix the bug in pr. If you want to use the fixed tauri now, you can either switch the tauri source to my forked git link in cargo.toml, or pull it locally. 这并不由我决定,但是我已经在pr中确实的解决了这个bug. 如果现在就想使用修复后的tauri, 你可以在cargo.toml中将tauri来源切换到我的fork的git链接, 或者pull 到本地使用. |
Signed-off-by: canxin <1969730106@qq.com>
…//github.com/canxin121/tauri into fix-clear-residual-listeners-tauri-apps#8916
…//github.com/canxin121/tauri into fix-clear-residual-listeners-tauri-apps#8916
Describe the bug
The following js code listens to an event in the useEffect and unlistens the event when the side effect is removed(when refreshing page).
It works fine in v1, and the haddle time will always be 1.
But in v2.x, after refreshing the page, the next listen handleTime will still be increased by 1, and all the triggered event have the same eventId. And when the browser console is open, the behavior is even strangler.
Below are the backend code.
v1 works fine:
v1.mp4
v2 :
V2.mp4
v2_with_console.mp4
Reproduction
https://github.com/canxin121/test_listen_v1 -> works fine
https://github.com/canxin121/test_listen_v2 -> works strangly
Expected behavior
The behavior of the v2.x version should be consistent with v1
Full
tauri info
outputfor v2:
Stack trace
In v2.x, with browser console open, got following trace.
The text was updated successfully, but these errors were encountered: