diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-06 09:05:51 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-06 09:05:51 +0200 |
| commit | 10c5d48413afaef88626419d8c4bf9fbf6f1c902 (patch) | |
| tree | fe6c86eaf16c16070aa8025e207e5d88bd5595c6 /internal/tui/dashboard | |
| parent | 0a69582e7f8111c2a508d8f062de91a06f296974 (diff) | |
Fix flamegraph navigation, filtering, and system-share feedback
Diffstat (limited to 'internal/tui/dashboard')
| -rw-r--r-- | internal/tui/dashboard/model.go | 2 | ||||
| -rw-r--r-- | internal/tui/dashboard/model_test.go | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/internal/tui/dashboard/model.go b/internal/tui/dashboard/model.go index ebd0c03..7ec1362 100644 --- a/internal/tui/dashboard/model.go +++ b/internal/tui/dashboard/model.go @@ -134,7 +134,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil } var animCmd tea.Cmd - if m.liveTrie != nil && !m.flamegraphModel.Paused() && m.liveTrie.Version() != m.flamegraphModel.LastVersion() { + if m.liveTrie != nil && !m.flamegraphModel.Paused() && (!m.flamegraphModel.HasSnapshot() || m.liveTrie.Version() != m.flamegraphModel.LastVersion()) { m.flamegraphModel.RefreshFromLiveTrie() animCmd = m.flamegraphModel.AnimationCmd() } diff --git a/internal/tui/dashboard/model_test.go b/internal/tui/dashboard/model_test.go index 6d35d5a..1dc1cc1 100644 --- a/internal/tui/dashboard/model_test.go +++ b/internal/tui/dashboard/model_test.go @@ -198,6 +198,23 @@ func TestFlameTickRefreshesFlamegraphModel(t *testing.T) { } } +func TestFlameTickLoadsInitialSnapshotWithoutVersionChange(t *testing.T) { + liveTrie := coreflamegraph.NewLiveTrie([]string{"comm", "path"}, "count") + + m := NewModelWithConfig(nil, nil, 250, common.DefaultKeyMap()) + m.SetLiveTrie(liveTrie) + m.activeTab = TabFlame + if m.flamegraphModel.HasSnapshot() { + t.Fatalf("expected fresh flame model to start without snapshot") + } + + next, _ := m.Update(flameTickMsg{}) + model := next.(Model) + if !model.flamegraphModel.HasSnapshot() { + t.Fatalf("expected flame tick to load initial snapshot even when trie version is unchanged") + } +} + func TestStreamPausedSupportsJKArrowsAndPageKeys(t *testing.T) { rb := eventstream.NewRingBuffer() for i := 0; i < 300; i++ { |
