feat: return HTMX fragment from GET /issues/{owner}/{repo}/{index} and GET /pulls/{owner}/{repo}/{index} when HX-Request header is present #196
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Issue #190 tracks inline expansion of triage cards on the dashboard. For that to work, the detail handlers must detect the
HX-Request: trueheader and return only the content fragment (no layout wrapper) rather than a full page.Currently
IssueDetailandPullDetailininternal/handlers/handlers.goalways callrenderPage(), which wraps the content in the full layout. They do not branch onisHTMX(r)for the detail view.What to do
IssueDetailhandler: after building the content HTML, checkisHTMX(r). If true, write only the content HTML directly withw.Header().Set("Content-Type", "text/html")andfmt.Fprint(w, buf.String()). Otherwise callrenderPage()as today.PullDetailhandler.hx-getcall (from #190) will trigger withHX-Request: true, receiving only the fragment to swap inline.handlers_test.gothat issues a GET to each detail route with theHX-Request: trueheader and asserts the response does NOT contain the layout boilerplate (e.g. no<nav class="bottom-nav">)Acceptance Criteria
GET /issues/{owner}/{repo}/{index}withHX-Request: truereturns a content fragment only (no<nav>, no<header>, no<html>wrapper)GET /pulls/{owner}/{repo}/{index}withHX-Request: truereturns a content fragment onlyHX-Requestheader is absentReferences
Triage: Assigned to @developer. When HX-Request header is present on GET /issues/{owner}/{repo}/{index} and GET /pulls/{owner}/{repo}/{index}, return only the HTMX content fragment instead of the full page. The
renderPage()function already handles this for other routes -- verify the detail templates also support thecontentnamed template block correctly. No dependencies. Priority: P1.Sprint planning update (2026-04-20): This is already implemented. The
renderPage()function ininternal/handlers/handlers.go(lines ~191-197) checksisHTMX(r)and returns just the content string whenHX-Request: trueis present, skipping the full layout wrapper. BothIssueDetailandPullDetailcallrenderPage(), so they already return HTMX fragments when the header is set.The unit test for this behavior (asserting no
<nav>in HTMX response) could still be added, but the functional implementation is done. The test is covered as part of #190 acceptance criteria. Closing as implemented.