refactor(ui): improve layout management and record sharing in App

Refactor App and DrillState to use Rc for sharing records, and introduce
rebuild_layout() to manage GridLayout lifecycle. This ensures the layout is
consistently updated when the model or drill state changes.

- Use Rc<Vec<(CellKey, CellValue)>> for DrillState.records to allow cheap
  cloning
- Add layout field to App
- Implement rebuild_layout() in App to refresh the GridLayout
- Update App::new and App::cmd_context to use the new layout management
- Ensure layout is rebuilt after applying effects and handling key events

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/gemma-4-26B-A4B-it-GGUF:UD-Q5_K_XL)
This commit is contained in:
Edward Langley
2026-04-06 23:18:39 -07:00
parent e8af67e2b0
commit a17802e07d
2 changed files with 43 additions and 24 deletions

View File

@ -398,7 +398,7 @@ pub struct StartDrill(pub Vec<(CellKey, CellValue)>);
impl Effect for StartDrill {
fn apply(&self, app: &mut App) {
app.drill_state = Some(super::app::DrillState {
records: self.0.clone(),
records: std::rc::Rc::new(self.0.clone()),
pending_edits: std::collections::HashMap::new(),
});
}