Skip to content

State management: persistence, resets, and URL restore#185

Open
atheurer wants to merge 1 commit intomasterfrom
web-ui-state-management
Open

State management: persistence, resets, and URL restore#185
atheurer wants to merge 1 commit intomasterfrom
web-ui-state-management

Conversation

@atheurer
Copy link
Copy Markdown
Contributor

@atheurer atheurer commented May 1, 2026

Summary

  • Lift supplementalMetrics to App so metric configs persist across Compare ↔ Deep Dive transitions
  • Reset all compare/dive state on clear selection and new search
  • Remove deepDiveConfigs snapshot — pass live supplementalMetrics to DeepDiveView
  • Remove deleted metrics from deepDiveMetrics set
  • Save iteration IDs (not run IDs) in URL for precise selection restore (backward compatible with old selectedRuns format)
  • Save deepDiveMetrics, deepDiveIterations, table column order, and hidden dims in URL hash
  • Only encode compare/dive state when view is not search (prevents stale state leaking)
  • Fix deep dive stale data when metric configs change (breakouts/filters)
  • Merge saved column order with computed dims on restore (keeps order, drops stale, appends new)

Test plan

  • Compare → Deep Dive → Compare: supplemental metrics persist
  • Delete metric in Compare → Deep Dive: deleted metric gone
  • Clear selection: all compare/dive state resets
  • New search: all compare/dive state resets
  • Share from Compare: URL restores to Compare with metrics
  • Share from Deep Dive: URL restores directly to Deep Dive with correct metrics/iterations
  • Share from Search: URL restores to Search with filters, results, and selected iterations
  • Reorder table columns, Share, restore: column order preserved
  • Old URLs with selectedRuns (run IDs): still work via fallback path

🤖 Generated with Claude Code

App.jsx:
- Lift supplementalMetrics from CompareView to App for persistence
  across Compare → Deep Dive → Compare transitions
- Remove deepDiveConfigs snapshot — pass supplementalMetrics directly
  to DeepDiveView so it always reflects current state
- Reset all compare/dive state on clear selection and new search
  (groupByList, hiddenFields, supplementalMetrics, deepDiveMetrics,
  deepDiveIterations, tableColumnOrder, tableHiddenDims)
- Save deepDiveMetrics and deepDiveIterations in URL hash
- Save iteration IDs (not run IDs) for precise selection restore
- Save table column order and hidden dims in URL hash
- Only encode compare/dive state when view is not search
- Backward compatible: old URLs with selectedRuns still work

CompareView.jsx:
- Receive supplementalMetrics/setSupplementalMetrics as props
- Remove useImperativeHandle (App has direct access)
- Remove setSupplementalMetrics([]) from mount effect
- Clear restoredMetrics after applying to prevent duplicate adds
- Guard against duplicate supplemental metric entries
- Fetch values for metrics hydrated from URL with empty values
- Remove metric from deepDiveMetrics when deleting it

DeepDiveView.jsx:
- Add JSON.stringify(metricConfigsProp) to fetch effect dependency
  so changed breakout configs trigger re-fetch
- Yield between sequential metric fetches for progressive rendering

IterationTable.jsx:
- Accept columnOrder/columnHidden props from App
- Merge saved column order with computed dims on init: keep saved
  order for dims that still exist, append new, drop stale
- Propagate reorder/hide changes to App via callbacks

Co-Authored-By: Claude Opus 4.6 (1M context) <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

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant