Skip to content

fix(session): rebuild session row fragment via shared builder (#53)#57

Merged
KucharczykL merged 10 commits into
mainfrom
feat/issue-53-session-row-fragment
Jun 20, 2026
Merged

fix(session): rebuild session row fragment via shared builder (#53)#57
KucharczykL merged 10 commits into
mainfrom
feat/issue-53-session-row-fragment

Conversation

@KucharczykL

Copy link
Copy Markdown
Owner

Fixes #53.

Problem

_session_row_fragment() had drifted from the live list_sessions table (4 columns vs 6, no id="session-row-{pk}") and was effectively dead — every session action button used a plain href (full nav), and the only htmx caller (reset_session_start) returned 204 + HX-Refresh. The fragment was an independent re-implementation of a session row, free to drift.

Change

  • One canonical row builder. Extract session_row_data() (the row dict) + session_row() (Node wrapper). Both list_sessions and the htmx fragment now render through the same builder + TableRow — no duplicated <tr> markup, drift impossible.
  • In-place row swap. end_session and reset_session_start (htmx) return Fragment(session_row(...), NavbarPlaytime(..., oob=True)): the row swaps into #session-row-{pk} and the navbar "Today · Last 7 days" totals refresh via an out-of-band swap (kept correct after the playtime recalc on save). List Finish/Reset buttons switched to htmx.
  • Clone stays full-reload. new_session_from_existing_session returns 204 + HX-Refresh (it adds a row; sort/pagination placement can't be a single-row swap).
  • Navbar playtime extracted into an OOB-swappable NavbarPlaytime component (id="navbar-playtime").
  • Deleted the stale hand-built fragment and orphaned imports.

Builders return Node; stringification happens only at the HttpResponse boundary.

Out of scope

The game-detail sessions table (different shape) keeps its full-nav buttons — standardizing all session tables on the canonical builder is tracked in #55.

Testing

  • New unit tests: session_row_data/session_row shape, NavbarPlaytime (incl. OOB), endpoint behavior (row + OOB navbar; reset has no HX-Refresh; clone returns HX-Refresh; non-htmx redirects).
  • New e2e: finish a running session from the list → row updates in place, timestamp_end set.
  • make check green: ruff lint + format + ts-check + 533 tests.

🤖 Generated with Claude Code

KucharczykL and others added 9 commits June 20, 2026 21:14
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Delete stale _session_row_fragment; end_session and reset_session_start
return the canonical row plus an OOB navbar-playtime fragment. Clone keeps
HX-Refresh since it changes row count. Fixes #53.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- SessionRowData.cell_data: list[Node | str] (date cells are str)
- strengthen test_session_row_fragment_via_htmx to assert OOB navbar

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

…lbar

Flowbite re-initialises popovers on every htmx swap. A popover hidden via
Tailwind `invisible` (visibility:hidden) still occupies layout, so once
Popper parks it with a transform offset it expands the table's
overflow-x-auto wrapper and a spurious scrollbar appears (horizontal here,
vertical in #40). Add `[&.invisible]:hidden` so the popover is removed from
layout while hidden; Flowbite drops `invisible` on show, restoring display.

Relates to #40. e2e regression covers no-overflow-after-swap plus
popover-still-shows-on-hover.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@KucharczykL KucharczykL merged commit fdbd0cd into main Jun 20, 2026
4 checks passed
@KucharczykL KucharczykL deleted the feat/issue-53-session-row-fragment branch June 20, 2026 20:56
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.

Stale _session_row_fragment no longer matches the live session list table

1 participant