diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-13 19:44:15 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-13 19:44:15 +0300 |
| commit | 78ea9e22e596255c5e23ce445d80641870674ca9 (patch) | |
| tree | 47dfc75179676ee6be6c79f7d61d14a232fdf680 /integrationtests/dir_test.go | |
| parent | 16e413799363871c1efd73527fba299dfdfadfd3 (diff) | |
keep View() pure by moving state transitions into Update() handlers
The dashboard model's View() was mutating sub-model state on every render:
it called streamModel.SetFooterVisible() and flameModel.SetViewport() on
local copies instead of keeping those fields in sync through Update().
Moved the sync points to the Update() handlers that trigger each change:
- handleWindowSize: syncs stream footer visibility alongside SetViewport
- handleHelpToggleKey: already updated flame viewport; now also updates
stream footer visibility when the help bar is toggled
- handleKey: syncs flame viewport when switching to the flame tab, covering
the case that window-resize and help-toggle do not
Aligned the stream model's initial showFooter value with the dashboard's
default showHelp=false in NewModelWithConfig so there is no mismatch on
the first render.
Also extracted numeric tab shortcuts into the tab registry via ShortcutKey
fields so handleShortcutKey no longer needs updating when tabs are added.
Updated two tests that bypassed Update() to set dimensions directly; they
now use WindowSizeMsg so sub-model viewports are initialised correctly
under the new pure-View contract.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'integrationtests/dir_test.go')
0 files changed, 0 insertions, 0 deletions
