Skip to content

feat(ui): persist JobLossGraph settings per job + fix chart height on control toggle#841

Open
MarcBate wants to merge 2 commits into
ostris:mainfrom
MarcBate:feat/job-loss-graph-settings-persistence
Open

feat(ui): persist JobLossGraph settings per job + fix chart height on control toggle#841
MarcBate wants to merge 2 commits into
ostris:mainfrom
MarcBate:feat/job-loss-graph-settings-persistence

Conversation

@MarcBate

Copy link
Copy Markdown

Summary

  • Persist settings per job — display toggles (Smoothed, Raw, Log Y, Clip outliers), smoothing %, plot stride, per-series enabled state, and x-axis zoom range are saved to localStorage keyed by job ID (loss-graph:<id>). Settings are restored automatically when navigating back to a job's loss graph.
  • Fix chart height jumping on Display button clicks — the post-creation setSize() call is now deferred to requestAnimationFrame so the browser completes layout before the legend height is measured, matching the behaviour of the existing ResizeObserver path.
  • Restore zoom after chart recreation — when a display option is toggled (causing uPlot to recreate), any saved zoom range is re-applied after the new chart is sized. Reset zoom clears the saved range.

Test plan

  • Open a job's loss graph, toggle Smoothed / Raw / Log Y, adjust Smoothing and Plot stride — verify chart height stays stable and controls don't cause it to resize.
  • Set a custom zoom range by drag-selecting on the chart. Navigate away and back — verify the zoom is restored.
  • Click Reset zoom — verify the full range is shown and the zoom is not re-applied on next visit.
  • Verify settings persist across page refresh (F5) for the same job, and that two different jobs maintain independent settings.
  • Verify series enabled/disabled state per job is restored correctly.

🤖 Generated with Claude Code

MarcBate and others added 2 commits May 22, 2026 11:13
… toggle

- Persist display toggles (Smoothed, Raw, Log Y, Clip outliers), smoothing,
  plot stride, series enabled state, and x-axis zoom range to localStorage
  keyed by job ID (loss-graph:<id>), so settings are restored when returning
  to a job's loss graph.
- Fix chart canvas height jumping when Display buttons are clicked: defer the
  post-creation setSize() call to requestAnimationFrame so the browser has
  completed layout and the legend's rendered height is accurate.
- Restore saved zoom range after chart recreation (e.g. after toggling a
  display option), and clear it cleanly on Reset zoom.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Initialise isZoomed from saved settings so the button is visible on first
  render, not only after the chart's setScale hook fires.
- Skip setIsZoomed(false) after chart creation when a zoom range will be
  restored, avoiding a flicker where the button momentarily disappears.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant