Skip to content

Commit

Permalink
Fix empty grids repeatedly requesting a discard
Browse files Browse the repository at this point in the history
fixes #5132
  • Loading branch information
lucasmerlin committed Sep 19, 2024
1 parent 00cb50e commit 07399c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/egui/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 07399c5

Please sign in to comment.