From 4c21b647bc711f6e80747d47e3cdc4089c4a2292 Mon Sep 17 00:00:00 2001 From: Sebastian G Date: Tue, 8 Sep 2026 15:56:46 +0200 Subject: [PATCH] fix: keep equipment filter when changing muscle group in exercise picker Selecting a body part after choosing an equipment type reset the equipment filter to 'all equipment', even when the new muscle group still had exercises for that equipment. The body-part chips called setEq('') unconditionally. Remove those resets from the per-body-part chips in the exercise picker and the library. The existing eqOn fallback (eqOpts.includes(eq) ? eq : '') already drops the filter for the current view when the new body part has nothing under it, without discarding the user's choice. The 'All', Favourites and Chosen chips still clear it, since they span every body part. Fixes #71 --- frontend/src/sheets.jsx | 8 ++++++-- frontend/src/views/Library.jsx | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx index 29a38ff..f01f346 100644 --- a/frontend/src/sheets.jsx +++ b/frontend/src/sheets.jsx @@ -901,11 +901,15 @@ function ExercisePicker({ onPick, close }) { {showAll ? t('Filter by "{0}"', profile.name) : t('Show all equipment')} } + {/* Changing muscle group keeps the equipment filter: if it still has exercises under the new + group the filter stays applied, and if not the eqOn fallback above drops it for this view + without forgetting the choice (issue #71). The favourites/chosen chips still clear it — + those are cross-body-part views where a stale equipment filter would be confusing. */}
1 ? '10px 0 6px' : '10px 0' }}> {favCount > 0 && } {chosenCount > 0 && } - - {BODYPARTS.map(b => )} + + {BODYPARTS.map(b => )}
{eqOpts.length > 1 &&
diff --git a/frontend/src/views/Library.jsx b/frontend/src/views/Library.jsx index 52eac47..1973b70 100644 --- a/frontend/src/views/Library.jsx +++ b/frontend/src/views/Library.jsx @@ -46,9 +46,12 @@ export default function Library() { {showAll ? t('Filter by "{0}"', profile.name) : t('Show all equipment')}
} + {/* Changing body part keeps the equipment filter (issue #71): the eqOn fallback above drops + it only for the current view if the new body part has nothing under it, without forgetting + the choice. "All" clears it, since it spans every body part. */}
1 ? 8 : 12 }}> - {BODYPARTS.map(b => )} + {BODYPARTS.map(b => )}
{eqOpts.length > 1 &&