-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add field-level attribute to set/get state. #1109
Comments
This is an important feature, that I do want to support eventually, but because its use case isn't needed except for in larger, professional applications, I think my time is better spent elsewhere in the meantime. If the lack of this feature bothers you or prevents you from using this library, or Yew itself, please leave a comment here so I can gauge interest. |
Enough changes to how the state system works recently now makes this feature plausible to implement. enum State {
Id(i32)
FormData(String, String),
SelectedResource(Url)
}
#[derive(Switch, Clone)]
enum AppRoute {
#[to="/home/{name}"]
Variant{
name: String,
#[state]
state: Option<State> // By default, holds nothing.
}
} |
Upon exploring this space, I have found some design deficiencies with respect to Because of the The way to overcome this problem is to simplify
This would have the add-on benefit of removing the |
With the router rewrite, |
Description
While the Switch trait allows for it, the derive Switch macro support for getting/setting the state is nonexistent, relying on manual implementations to actually allow setting the state.
This is fine for the moment, where just supporting the
()
state type is acceptable, but in the future, the macro needs to support setting and getting the state.This might look like:
The text was updated successfully, but these errors were encountered: