fix(core): race between drop old JS listeners and create new listeners on page load (#9144)

* fix(core): race between drop old JS listeners and create new listeners on page load

* Create fix-js-unlisten-all-race.md
This commit is contained in:
i-c-b 2024-03-11 11:03:02 -05:00 committed by GitHub
parent c3ea3a2b7d
commit 85de230f31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch:bug
---
Fix old JS listeners being dropped on page load after it was possible to create new listeners.

View File

@ -571,7 +571,7 @@ tauri::Builder::default()
.on_page_load_handler
.replace(Box::new(move |url, event| {
if let Some(w) = manager_.get_webview(&label_) {
if let PageLoadEvent::Finished = event {
if let PageLoadEvent::Started = event {
w.unlisten_all_js();
}
if let Some(handler) = self.on_page_load_handler.as_ref() {