From 07399c5475739d37de228fbcd59233a74a44966e Mon Sep 17 00:00:00 2001 From: Lucas Meurer Date: Thu, 19 Sep 2024 14:33:43 +0200 Subject: [PATCH] Fix empty grids repeatedly requesting a discard fixes #5132 --- crates/egui/src/grid.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/grid.rs b/crates/egui/src/grid.rs index 42296e36290..9b3a382ee23 100644 --- a/crates/egui/src/grid.rs +++ b/crates/egui/src/grid.rs @@ -262,7 +262,9 @@ impl GridLayout { } pub(crate) fn save(&self) { - if self.curr_state != self.prev_state { + // We need to always save state on the first frame, otherwise request_discard + // would be called repeatedly (see #5132) + if self.curr_state != self.prev_state || self.is_first_frame { self.curr_state.clone().store(&self.ctx, self.id); self.ctx.request_repaint(); }