Repository navigation
Allow deleting a workout session from the calendar - #1326
Merged
rolandgeider merged 2 commits intoOct 23, 2026
Merged
Conversation
Storing the clicked DayProps may leave the entries panel on a stale copy once the month changes. Keep only the date, derive the month and the day's data from it, and move the selection along when changing months.
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
DeleteConfirmationModalbefore anything is deleted, and the dialog says that the sets logged in the session are deleted too (WorkoutLog.sessionison_delete=CASCADEon the server).deleteSession()API call (DELETE /api/v2/workoutsession/<id>/) anduseDeleteSessionQuery(). On success it invalidates the session reads, routine log data/stats and exercise analytics.CalendarComponentnow passes the selected day's entries toEntriesfrom the current query data (matched by date), instead of from theDayPropsobject stored when the day was clicked. Without this, a deleted session stayed in the panel, or the panel jumped back to today when the data refreshed. This replaces the effect that re-selected today whenever the data changed. The initial selection is still today.Related Issue(s)
Closes wger-project/wger#2002. In that issue, deleting a session from the UI was confirmed as not possible yet and a PR was invited.
Please check that the PR fulfills these requirements
Tests added:
session.test.ts:deleteSessionsends a DELETE to/workoutsession/<id>/Entries.test.tsx: delete runs only after confirming, and closing the dialog deletes nothingCalendarComponent.test.tsx: after a delete the session disappears from the selected day and the selection stays on that day. This test fails without theCalendarComponentchange.What I ran locally (Node 24):
LANG=de_de npx vitest run(180 files / 1178 tests pass),npx eslinton the changed files, andnpx tsc --noEmit. I didn't test this manually against a running wger server.AI assistance was used to write this change. I reviewed the diff and ran the checks above.