Skip to content

How to create a view which conditionally selects the child view to show? #485

Closed Answered by AaronErhardt
chriskilding asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry for the late reply. Yes, I am actually aware of this behavior and this is a trade-off that was made during the implementation. The way that conditional widgets work currently, everything is initialized. This means that all properties need to be initialized as well and most importunately this initialization needs to be unconditionally. Therefore you can't use variables from destructured fields because Relm4 can't know if they will be available during initialization. Properties with #[watch] and #[track] however will work because they will be updated as soon as their conditional branch is visible and don't need to be initialized upfront.

I hope this makes sense to you and this is also…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@AaronErhardt
Comment options

@chriskilding
Comment options

@AaronErhardt
Comment options

Answer selected by chriskilding
@chriskilding
Comment options

@chriskilding
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants