public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Shannon Sterz <s.sterz@proxmox.com>,
	Yew framework devel list at Proxmox <yew-devel@lists.proxmox.com>
Subject: Re: [yew-devel] [PATCH yew-comp 3/4] wizard: optimize enbaled check for next button
Date: Wed, 7 May 2025 10:23:44 +0200	[thread overview]
Message-ID: <51a2cd86-24de-4a98-b688-7b7510d7ad7e@proxmox.com> (raw)
In-Reply-To: <D9PS2B3I565C.3JIQI14XCATTR@proxmox.com>

On 5/7/25 10:15, Shannon Sterz wrote:
> On Tue May 6, 2025 at 3:26 PM CEST, Dominik Csapak wrote:
>> 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@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()
>> +        };
> 
> couldn't this be more simply:
> 
> let next_is_enabled = !self.loading && state.can_progress();
> 
> i think that reads a bit more easily ("state isn't `loading` and we can
> progress").
> 

true,, i'll send a v2

>>
>>           let next_page = props
>>               .pages
> 



_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel


  reply	other threads:[~2025-05-07  8:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06 13:26 [yew-devel] [PATCH yew-comp 1/4] wizard: move page valid/lock data into WizardState Dominik Csapak
2025-05-06 13:26 ` [yew-devel] [PATCH yew-comp 2/4] wizard: factor out 'can progress' logic check to WizardState Dominik Csapak
2025-05-06 13:26 ` [yew-devel] [PATCH yew-comp 3/4] wizard: optimize enbaled check for next button Dominik Csapak
2025-05-07  8:15   ` Shannon Sterz
2025-05-07  8:23     ` Dominik Csapak [this message]
2025-05-06 13:26 ` [yew-devel] [PATCH yew-comp 4/4] wizard: fix form progressing when pressing enter Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51a2cd86-24de-4a98-b688-7b7510d7ad7e@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=s.sterz@proxmox.com \
    --cc=yew-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal