Panic if element state is used twice in the same frame

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-02-14 14:04:27 -08:00
parent 7b666af0cf
commit ddc1f237a6
2 changed files with 46 additions and 10 deletions

View file

@ -62,6 +62,7 @@ impl Presenter {
}
pub fn invalidate(&mut self, mut invalidation: WindowInvalidation, cx: &mut MutableAppContext) {
cx.start_frame();
for view_id in invalidation.removed {
invalidation.updated.remove(&view_id);
self.rendered_views.remove(&view_id);
@ -81,6 +82,7 @@ impl Presenter {
invalidation: Option<WindowInvalidation>,
cx: &mut MutableAppContext,
) {
cx.start_frame();
if let Some(invalidation) = invalidation {
for view_id in invalidation.removed {
self.rendered_views.remove(&view_id);