Skip to content

Part of Phase 1 (Sub-1c): Move trace timeline layout prefs to Zustand#3719

Merged
yurishkuro merged 1 commit intojaegertracing:mainfrom
Parship12:layout-prefs-Zustand
Apr 10, 2026
Merged

Part of Phase 1 (Sub-1c): Move trace timeline layout prefs to Zustand#3719
yurishkuro merged 1 commit intojaegertracing:mainfrom
Parship12:layout-prefs-Zustand

Conversation

@Parship12
Copy link
Copy Markdown
Member

@Parship12 Parship12 commented Apr 10, 2026

Which problem is this PR solving?

Description of the changes

  • Before these changes, the code had one place (duck.ts) that was responsible for three things: storing layout settings (column widths, panel mode, etc.) in Redux, saving those settings to localStorage (so they survive page refresh), reading from localStorage on startup to restore our preferences. This is too much responsibility in one place. The goal of this PR(sub-pr 1) is to move the localStorage responsibility into a new Zustand store.
  • Added trace-timeline-store.ts + tests; updates TracePage, TraceTimelineViewer, duck and related tests.
  • Matched the migration plan: client UI prefs in Zustand, we now have a clear path to simplify Redux in future PRs.
  • Our planning for 1c is like:
    • Sub-PR 1 -> Layout prefs (DONE)
    • Sub-PR 2 -> collapse/detail
    • Sub-PR 3 -> Hover
    • Sub-PR 4 -> remove tracking middleware + delete duck.ts

How was this change tested?

  • Unit testing
  • Manual testing:
    • Span name column width: Refresh the page -> width should feel the same
    • Side panel mode: Refresh -> mode should stick (detailPanelMode in localStorage)
    • Timeline bars visible: Refresh -> preference should be there (timelineVisible in localStorage)
    • Side panel width: Refresh -> should be remembered (sidePanelWidth in localStorage)

Checklist

AI Usage in this PR (choose one)

See AI Usage Policy.

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

Signed-off-by: Parship Chowdhury <parshipchowdhury@gmail.com>
@Parship12 Parship12 requested a review from a team as a code owner April 10, 2026 15:01
Copilot AI review requested due to automatic review settings April 10, 2026 15:01
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 92.55319% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.22%. Comparing base (6f319e2) to head (bf77106).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...kages/jaeger-ui/src/stores/trace-timeline-store.ts 93.93% 3 Missing and 1 partial ⚠️
...components/TracePage/TraceTimelineViewer/index.tsx 81.25% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3719      +/-   ##
==========================================
+ Coverage   89.21%   89.22%   +0.01%     
==========================================
  Files         330      331       +1     
  Lines        9889     9970      +81     
  Branches     2568     2591      +23     
==========================================
+ Hits         8822     8896      +74     
- Misses        925      931       +6     
- Partials      142      143       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Parship12 Parship12 changed the title Part of Phase 1 (1c): Move trace timeline layout prefs to Zustand Part of Phase 1 (Sub-1c): Move trace timeline layout prefs to Zustand Apr 10, 2026
});

it('persists mode to localStorage', () => {
it('does not persist mode to localStorage (persistence moved to useTraceTimelineStore)', () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes in this file are similar, but the alternative approach would be to check that the settings DID persist, just in a different storage.

Having said that, detailPanelMode and timelineVisible are absolutely meant to be persisted to local storage as sticky configuration options (user profile style), they are not supposed to be lost when UI reloads.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw a future enhancement: #3720

Copy link
Copy Markdown
Member Author

@Parship12 Parship12 Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tests are edited, just to stop them from failing.

The localStorage persistence is still there, it's now handled by useTraceTimelineStore, which is tested in src/stores/trace-timeline-store.test.ts.

The duck tests for these 4 actions are temporary, the duck itself will be deleted in next sub-PRs along with the remaining redux state. At that point, the only persistence tests will be the ones in trace-timeline-store.test.ts

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw a future enhancement: #3720

our Zustand store is already a good foundation for it.

@yurishkuro yurishkuro added the changelog:refactoring Internal, non-functional code improvements label Apr 10, 2026
@yurishkuro yurishkuro merged commit 3ba9b91 into jaegertracing:main Apr 10, 2026
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:refactoring Internal, non-functional code improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants