Skip to content

Commit 3c9710a

Browse files
committed
removed bloated code
1 parent d0732f0 commit 3c9710a

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

frontend/wasm/src/lib.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,8 @@ pub fn panic_hook(info: &panic::PanicHookInfo) {
7474
log::error!("{info}");
7575

7676
// Prefer using the raw JS callback to avoid mutex lock contention inside the panic hook.
77-
// Fall back to the editor handle path if needed.
7877
if let Err(info) = send_panic_dialog_via_callback(info) {
79-
if let Err(info) = send_panic_dialog(info) {
80-
send_panic_dialog_deferred(info);
81-
}
78+
send_panic_dialog_deferred(info);
8279
}
8380
}
8481

@@ -114,22 +111,10 @@ fn send_panic_dialog_via_callback(panic_info: String) -> Result<(), String> {
114111
})
115112
}
116113

117-
fn send_panic_dialog(panic_info: String) -> Result<(), String> {
118-
EDITOR_HANDLE.with(|editor_handle| {
119-
let mut guard = editor_handle.try_lock();
120-
let Ok(Some(handle)) = guard.as_deref_mut() else {
121-
return Err(panic_info);
122-
};
123-
124-
handle.send_frontend_message_to_js_rust_proxy(FrontendMessage::DisplayDialogPanic { panic_info });
125-
Ok(())
126-
})
127-
}
128-
129114
#[cfg(not(feature = "native"))]
130115
fn send_panic_dialog_deferred(panic_info: String) {
131116
let callback = Closure::once_into_js(move || {
132-
if send_panic_dialog(panic_info).is_err() {
117+
if send_panic_dialog_via_callback(panic_info).is_err() {
133118
log::error!("Failed to send crash dialog after panic because the editor handle is unavailable");
134119
}
135120
});

0 commit comments

Comments
 (0)