summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/model.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tui/dashboard/model.go')
-rw-r--r--internal/tui/dashboard/model.go22
1 files changed, 6 insertions, 16 deletions
diff --git a/internal/tui/dashboard/model.go b/internal/tui/dashboard/model.go
index 2104cb6..1c6f66c 100644
--- a/internal/tui/dashboard/model.go
+++ b/internal/tui/dashboard/model.go
@@ -173,7 +173,9 @@ func (m Model) Init() tea.Cmd {
cmds := []tea.Cmd{tickCmd(m.refreshEvery)}
d := lookupTab(m.activeTab)
if d.InitCmd != nil {
- cmds = append(cmds, d.InitCmd())
+ // Pass the model so the closure can read fastRefreshEvery and use
+ // the configured cadence rather than falling back to a constant.
+ cmds = append(cmds, d.InitCmd(&m))
} else if m.bubbleEnabledForTab(m.activeTab) {
cmds = append(cmds, bubbleTickCmdFn())
}
@@ -791,7 +793,9 @@ func (m Model) postKeyTransitionCmd(prevActiveTab Tab, cmd tea.Cmd) tea.Cmd {
if prevActiveTab != m.activeTab {
d := lookupTab(m.activeTab)
if d.InitCmd != nil {
- cmds = append(cmds, d.InitCmd())
+ // Pass the model so the closure reads fastRefreshEvery and honours
+ // the configured cadence from the first tick after a tab switch.
+ cmds = append(cmds, d.InitCmd(&m))
} else if m.bubbleEnabledForTab(m.activeTab) {
cmds = append(cmds, bubbleTickCmdFn())
}
@@ -1530,20 +1534,6 @@ func (m Model) flameTickCmd() tea.Cmd {
return tea.Tick(d, func(time.Time) tea.Msg { return flameTickMsg{} })
}
-// streamTickCmdFn is a package-level adapter used by the tab registry's InitCmd
-// field. It uses the constant cadence and is replaced on subsequent ticks by
-// the model-method version that respects fastRefreshEvery.
-func streamTickCmdFn() tea.Cmd {
- return tea.Tick(streamRefreshMs*time.Millisecond, func(time.Time) tea.Msg { return streamTickMsg{} })
-}
-
-// flameTickCmdFn is a package-level adapter used by the tab registry's InitCmd
-// field. It uses the constant cadence and is replaced on subsequent ticks by
-// the model-method version that respects fastRefreshEvery.
-func flameTickCmdFn() tea.Cmd {
- return tea.Tick(flameRefreshMs*time.Millisecond, func(time.Time) tea.Msg { return flameTickMsg{} })
-}
-
func bubbleTickCmdFn() tea.Cmd {
return tea.Tick(bubbleRefreshMs*time.Millisecond, func(time.Time) tea.Msg { return bubbleTickMsg{} })
}