Ensure we remove broadcast channels after all conditions resolve

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo 2021-04-20 10:43:13 -06:00
parent dcc2bdfd4c
commit 1a8e909a38

View file

@ -3332,6 +3332,10 @@ mod tests {
model.update(&mut app, |model, ctx| model.inc(ctx));
assert_eq!(poll_once(&mut condition2).await, Some(()));
// Broadcast channel should be removed if no conditions remain on next notification.
model.update(&mut app, |_, ctx| ctx.notify());
app.update(|ctx| assert!(ctx.async_observations.get(&model.id()).is_none()));
});
}
@ -3409,6 +3413,10 @@ mod tests {
view.update(&mut app, |view, ctx| view.inc(ctx));
assert_eq!(poll_once(&mut condition2).await, Some(()));
// Broadcast channel should be removed if no conditions remain on next notification.
view.update(&mut app, |_, ctx| ctx.notify());
app.update(|ctx| assert!(ctx.async_observations.get(&view.id()).is_none()));
});
}