Skip to content

Commit 6edee0f

Browse files
Yanchek99claude
andcommitted
Base the ladder-fields row's initial hidden state on the first segment
Task review for #1756 found a real flash bug: _form.html.slim computed ladder_hidden from Workout#governing_segment, but ladder_fields_controller.js resolves its rounds/time/interval targets to the first segment in DOM order (the one the JS was wired to in this task). Those only agree when a workout has exactly one segment or exactly one schemed segment. Confirmed via direct computation against live seed data: at least two real workouts (Dallas 5, Nukes -- multiple schemed segments, so no governing segment, but an AMRAP-shaped first segment) had server-rendered hidden=true flip to visible the instant the controller's connect() ran, since it reads the first segment regardless. Fixed by sourcing ladder_hidden from `segments.first` instead, matching what the JS actually targets. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 0b8b0fb commit 6edee0f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

app/views/workouts/_form.html.slim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- cancel_path = @workout.persisted? ? workout_path(@workout) : workouts_path
2-
- ladder_segment = @workout.governing_segment
2+
- ladder_segment = @workout.segments.first
33
- ladder_hidden = ladder_segment.blank? || ladder_segment.time_seconds.blank? || ladder_segment.rounds.present? || ladder_segment.interval_scheme.present?
44

55
= simple_form_for @workout, wrapper: :vertical_form, html: { class: 'workout-form', data: { controller: 'ladder-fields' } } do |f|

0 commit comments

Comments
 (0)