Context
This follow-up task was identified during the review of PR #74.
Source PR: #74
PR Title: feat: patterns example Session 4 (patterns #17-21) — dialogs, tabs & navigation
Suggested by: @claude[bot] (PR comment, recurring across rounds 5, 7, 9, 10, 11)
Task Description
patterns/handlers_navigation.go defines spaNavMaxStep = 3, but templates/navigation/spa-navigation.tmpl hardcodes Step {{.Step}} of 3 with the 3 as a literal.
If spaNavMaxStep is ever changed (e.g., to demonstrate a 5-step flow), the template silently shows the wrong total.
Suggested Fix
Add a MaxStep int field to SPANavState and populate it in Mount (or in the handler factory's initial state), then render Step {{.Step}} of {{.MaxStep}} in the template.
type SPANavState struct {
Title string
Category string
Step int
MaxStep int
}
func (c *SPANavController) Mount(state SPANavState, ctx *livetemplate.Context) (SPANavState, error) {
state.MaxStep = spaNavMaxStep
// ... existing logic
}
Original Comment
spaNavMaxStep const vs. template literal "3" — handlers_navigation.go defines spaNavMaxStep = 3, but the template hardcodes Step {{.Step}} of 3. If the constant ever changes, the template won't follow. Consider passing max step through the state struct (SPANavState.MaxStep) so the template can render of {{.MaxStep}}.
Auto-created by prmonitor from PR review comments.
Context
This follow-up task was identified during the review of PR #74.
Source PR: #74
PR Title: feat: patterns example Session 4 (patterns #17-21) — dialogs, tabs & navigation
Suggested by: @claude[bot] (PR comment, recurring across rounds 5, 7, 9, 10, 11)
Task Description
patterns/handlers_navigation.godefinesspaNavMaxStep = 3, buttemplates/navigation/spa-navigation.tmplhardcodesStep {{.Step}} of 3with the3as a literal.If
spaNavMaxStepis ever changed (e.g., to demonstrate a 5-step flow), the template silently shows the wrong total.Suggested Fix
Add a
MaxStep intfield toSPANavStateand populate it inMount(or in the handler factory's initial state), then renderStep {{.Step}} of {{.MaxStep}}in the template.Original Comment
Auto-created by prmonitor from PR review comments.