Files
SubMiner/backlog/tasks/task-187.1 - Auto-expand-targeted-session-when-opening-media-detail.md
sudacode f2b3af17d7 docs: update docs, add backlog tasks and change notes
Update configuration, immersion tracking, and mining workflow docs.
Add backlog tasks for upcoming work items and change notes for recent
features and fixes.
2026-03-17 20:12:42 -07:00

55 lines
2.8 KiB
Markdown

---
id: TASK-187.1
title: Auto-expand targeted session when opening media detail
status: In Progress
assignee:
- codex
created_date: '2026-03-18 01:32'
updated_date: '2026-03-18 01:36'
labels:
- stats
- ui
dependencies: []
references:
- stats/src/lib/stats-navigation.ts
- stats/src/App.tsx
- stats/src/components/overview/RecentSessions.tsx
- stats/src/components/library/MediaDetailView.tsx
- stats/src/components/library/MediaSessionList.tsx
- stats/src/lib/stats-navigation.test.ts
parent_task_id: TASK-187
priority: medium
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
When a navigation path opens episode/media detail with a known session ID, the matching session row in media detail should auto-expand so the user lands directly on the intended session details instead of only the episode history page.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 Media detail navigation state can carry an optional target session ID alongside the selected video.
- [ ] #2 Any navigation path that opens media detail with a known session ID causes that session row to auto-expand when the episode history loads.
- [ ] #3 Session-tab fallback for orphan sessions without a video still behaves as it does now.
- [ ] #4 Media detail auto-expansion clears or stabilizes its one-shot navigation state so normal manual expand/collapse behavior still works after landing.
- [ ] #5 Relevant navigation/component tests cover the targeted media-detail auto-expand behavior.
<!-- AC:END -->
## Implementation Plan
<!-- SECTION:PLAN:BEGIN -->
1. Extend media-detail navigation state to optionally carry a target session ID while preserving the existing orphan-session fallback to the Sessions tab.
2. Update app-level navigation helpers and overview recent-session click handling to pass session IDs into media-detail navigation whenever both video and session are known.
3. Thread the one-shot target session ID into MediaDetailView and MediaSessionList so the matching accordion row auto-expands on load, then clear/stabilize that state so manual toggling still behaves normally.
4. Update targeted stats navigation/component tests to cover media-detail auto-expansion and fallback behavior.
<!-- SECTION:PLAN:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
Extended media-detail navigation state to carry an optional `initialSessionId`, updated overview/app navigation to pass session IDs into media detail whenever a video-backed session is clicked, and wired `MediaDetailView` + `MediaSessionList` to auto-expand and then consume that one-shot session target.
Updated `stats-navigation.test.ts` to cover the new navigation-state shape. Validation not run in this pass, so acceptance criteria remain unchecked pending verification.
<!-- SECTION:NOTES:END -->