Skip to content

Commit

Permalink
fix(core): race between drop old JS listeners and create new listener…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
i-c-b authored Mar 11, 2024
1 parent c3ea3a2 commit 85de230
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/fix-js-unlisten-all-race.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch:bug
---

Fix old JS listeners being dropped on page load after it was possible to create new listeners.
2 changes: 1 addition & 1 deletion core/tauri/src/webview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 85de230

Please sign in to comment.