[yew-devel] [PATCH yew-comp 3/4] wizard: optimize enbaled check for next button

Dominik Csapak d.csapak at proxmox.com
Tue May 6 15:26:32 CEST 2025


by first checking for `self.loading` since we don't have to iterate
over the wizard pages if that is true.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/wizard.rs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/wizard.rs b/src/wizard.rs
index e33d3c6..16b1dd8 100644
--- a/src/wizard.rs
+++ b/src/wizard.rs
@@ -635,11 +635,11 @@ impl PwtWizard {
             Some(key) => props.pages.get_index_of(key).unwrap_or(0),
         };
 
-        let mut next_is_enabled = state.can_progress();
-
-        if self.loading {
-            next_is_enabled = false;
-        }
+        let next_is_enabled = if self.loading {
+            false
+        } else {
+            state.can_progress()
+        };
 
         let next_page = props
             .pages
-- 
2.39.5





More information about the yew-devel mailing list