From caedfc90828379a778f9f7891b02817022788879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Husi=C4=8Dka?= <25853767+DavidHusicka@users.noreply.github.com> Date: Sat, 30 Nov 2024 23:36:05 +0100 Subject: [PATCH] Remove use of the `todo` macro in event handling and add a comment about it being a todo (#168) Using the `todo` macro causes a panic when this event is encountered. Noop is preferable in this case as it does not crash the application. This is especially annoying on platforms where `Ime::Enabled` event is sent upon application start even when the user is using a keyboard layout that does not need an IME support. There was added a "TODO" comment that informs about this feature being missing. Most IDEs and code editors have support/plugins/extensions to work with this type of comments and this type of comment is already used widely across the codebase. As such, the information about this feature not being implemented is not lost. --- packages/dioxus-native/src/dioxus_document.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/dioxus-native/src/dioxus_document.rs b/packages/dioxus-native/src/dioxus_document.rs index 378a3e1a..f656866a 100644 --- a/packages/dioxus-native/src/dioxus_document.rs +++ b/packages/dioxus-native/src/dioxus_document.rs @@ -279,8 +279,9 @@ impl DocumentLike for DioxusDocument { } } } - EventData::Ime(_) => todo!(), - EventData::Hover => todo!(), + // TODO: Implement IME and Hover events handling + EventData::Ime(_) => {} + EventData::Hover => {} } if !prevent_default {