Enhance TrainingCoachPage and trainingPlanUtils with session storage management and phase handling improvements
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m8s
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m8s
- Introduced a new function in TrainingCoachPage to clear session storage for coach steps, improving state management during training sessions. - Updated the sectionsWithPlanLocForDisplay function in trainingPlanUtils to include logic for determining the maximum phase order index, enhancing phase handling. - Enhanced the mapping of sections to include default plan locations for parallel phases, optimizing data representation and user experience.
This commit is contained in:
1 parent
73ac2218c7
commit
5e5350d5ac
2 files changed
+45
-1
No files matched your search
@@ -27,6 +27,18 @@ function storageStepKey(unitId, mergedPicks) {
|
||||
return `sj_coach_step_${unitId}_${coachBranchPicksStepStorageSuffix(mergedPicks)}`
|
||||
}
|
||||
|
||||
function clearCoachStepStorageForUnit(unitId) {
|
||||
const pref = `sj_coach_step_${unitId}_`
|
||||
try {
|
||||
for (let i = sessionStorage.length - 1; i >= 0; i -= 1) {
|
||||
const k = sessionStorage.key(i)
|
||||
if (k && k.startsWith(pref)) sessionStorage.removeItem(k)
|
||||
}
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
function storageDeltasKey(unitId) {
|
||||
return `sj_coach_deltas_${unitId}`
|
||||
}
|
||||
@@ -614,9 +626,12 @@ export default function TrainingCoachPage() {
|
||||
sessionStorage.removeItem(storageDeltasKey(idNum))
|
||||
sessionStorage.removeItem(storageDebriefKey(idNum))
|
||||
sessionStorage.removeItem(coachBranchPicksStorageKey(idNum))
|
||||
clearCoachStepStorageForUnit(idNum)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
setSearchParams({}, { replace: true })
|
||||
setStep(0)
|
||||
setDeltas({})
|
||||
setBranchPicks({})
|
||||
setStreamChoiceHint(null)
|
||||
|
||||
Reference in new issue
Block a user