Skip to content
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

child_signal_vec unwraps on a None value when the SignalVec is empty #3

Open
broomlytinum opened this issue May 11, 2022 · 0 comments

Comments

@broomlytinum
Copy link

I've been working with this version of Pinwheel due to an issue with nested block_ons in child_signal_vec when the child nodes have dynamic components themselves. I'm assuming the usage of now_or_never is to avoid this scenario (or a similar one?).

However, I believe there is an issue with unwrapping the result of now_or_never, as the future will be pending if the SignalVec is empty.

This smaller example demonstrates the panic:

use futures::{future::FutureExt, stream::StreamExt};
use futures_signals::signal_vec::{SignalVecExt, MutableVec};

fn main() {
    let vec = MutableVec::<bool>::new();

    vec.signal_vec()
        .to_stream()
        .next()
        .now_or_never()
        .unwrap();
}

I don't believe there's any need to unwrap it, and any alternative I can think of without unwrapping has the same end result. Though, I'm uneasy with leaving an Option unwrapped like that, so I haven't simply submitted a pull request.

If disallowing zero children in child_signal_vec was an intentional design decision, you may disregard this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant