[yew-devel] [RFC yew-comp] refactor: move LoadableComponent state into component implementations

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Dec 10 10:32:44 CET 2025


Am 10.12.25 um 10:23 schrieb Dietmar Maurer:
> 
> On 12/10/25 8:53 AM, Thomas Lamprecht wrote:
>> Spotted another typo, and while checking that I found a parameter name a bit
>>
>>
>> Am 09.12.25 um 15:36 schrieb Dietmar Maurer:
>>> +pub struct LoadableComponentState<V: PartialEq> {
>>> +    loading: usize,
>>> +    last_load_error: Option<String>,
>>> +    repeat_timespan: u32, /* 0 => no repeated loading */
>> nit: repeat is IMO a bit generic for what this is used for and reads a tiny bit
>> awkwardly to me as I do not recognize that as widely used term for these thing.
>> Using timespan for interval or polling period feels also slightly odd.
>>
>> You could use "reload_interval", that's apt, telling and fits to the reload_timeout
>> below. Adapting the repeated_load function to reload_interval (or set_reload_interval)
>> would make it also a bit more telling IMO, as is, it's not as clear as it could be
>> that this is a period for anybody not used to the code.
> 
> Maybe we can defer that renaming after the structural changes got in?

Sure, just thought it might be less churn now if you touch that much
code anyway already it might not be that much extra work, but having it
as separate change might indeed be nicer, so fine by me.

> Anyways, I will send a v2 including the typo fixes.
> 
> Also, Dominik found a way to avoid send_custom_message() and custom_callback(),
> simply by implementing:
> 
> 
> impl<M, V: PartialEq> From<M> for Msg<M, V> {
>     fn from(value: M) -> Self {
>         Msg::ChildMessage(value)
>     }
> }

great, that's better!




More information about the yew-devel mailing list