Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

curated2: !48 (code only; its test file predates the current mock setup)

Duarte Santosd36fa68a61d4
diff --cc frontend/src/views/Workout.jsx
index b9d06a42e,393c659a2..a74c3bdef
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@@ -282,35 -279,19 +286,38 @@@ function ActiveWorkout()
const nav = useNavigate()
const S = useStore(s => s.S)
const update = useStore(s => s.update)
- const { startRest, stopRest, work } = useUI()
+ const { startRest, stopRest, stopWork, work } = useUI()
const A = S.active
const units = supersetUnits(A.entries)
- const cur = Math.min(A.cur, Math.max(0, A.entries.length - 1))
+ const cur = Number.isInteger(A.cur)
+ ? Math.min(Math.max(A.cur, 0), Math.max(0, A.entries.length - 1))
+ : 0
const unit = A.entries.length ? unitOf(units, cur) : []
const unitIdx = units.findIndex(u => u === unit)
const isSuperset = unit.length > 1
- // Superset flow: keep the active exercise in view - completing a set scrolls to the
- // next exercise in the group, then back up to the first exercise of the next round.
- const exRefs = useRef({})
+ // Superset flow: center the actionable row when completing a set moves to the partner or
+ // back to the first exercise of the next round. Entry-bound maps keep repeated exercise IDs
+ // distinct, while each rendered set index identifies the existing row within that entry.
+ const exRefs = useRef(new Map())
+ const setRefs = useRef(new Map())
+ const bindExRef = (entry, el) => {
+ if (el) exRefs.current.set(entry, el)
+ else {
+ exRefs.current.delete(entry)
+ setRefs.current.delete(entry)
+ }
+ }
+ const bindSetRef = (entry, setIdx, el) => {
+ let refs = setRefs.current.get(entry)
+ if (el) {
+ if (!refs) { refs = new Map(); setRefs.current.set(entry, refs) }
+ refs.set(setIdx, el)
+ } else if (refs) {
+ refs.delete(setIdx)
+ if (!refs.size) setRefs.current.delete(entry)
+ }
+ }
+ const swipe = useRef(null)
const progressHighWater = useRef(A.entries.map(e => e.sets.filter(s => s.done).length))
// The marks are index-keyed, and removing an exercise shifts every index above it down
// (removeActiveExercise splices). Re-baseline whenever the list length changes, otherwise a